Skip to content

Instantly share code, notes, and snippets.

@safarmer
Created January 23, 2021 01:10
Show Gist options
  • Save safarmer/7d112dd6e22bcf96286623b06e7191c3 to your computer and use it in GitHub Desktop.
Save safarmer/7d112dd6e22bcf96286623b06e7191c3 to your computer and use it in GitHub Desktop.
A Wallaby.js configuration that works for testing release-please
module.exports = wallaby => {
const path = require('path');
process.env.NODE_PATH +=
path.delimiter + path.join(wallaby.projectCacheDir, 'src');
return {
autoDetect: false,
files: [
'src/**/*.ts',
{pattern: 'package.json', instrument: false},
{pattern: 'test/**/*.json', instrument: false},
{pattern: 'test/**/fixtures/**/*', instrument: false},
{pattern: '__snapshots__/**/*', instrument: false},
],
tests: ['test/**/*.ts'],
env: {
type: 'node',
runner: 'node',
params: {
env: 'INFO=nock.*',
},
},
testFramework: 'mocha',
compilers: {
'**/*.ts': wallaby.compilers.typeScript(),
},
setup: wallaby => {
const mocha = wallaby.testFramework;
const sinon = require('sinon');
// setup sinon hooks
mocha.suite.beforeEach('sinon before', function () {
if (null === this.sinon) {
this.sinon = sinon.createSandbox();
}
});
mocha.suite.afterEach('sinon after', function () {
if (this.sinon && 'function' === typeof this.sinon.restore) {
this.sinon.restore();
}
});
global.expect = require('chai').expect;
},
workers: {recycle: true},
debug: false,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment