From bb2c7de299934e918fbb50b310f326628b69ddd2 Mon Sep 17 00:00:00 2001 From: Andrew Prifer <2991360+AndrewPrifer@users.noreply.github.com> Date: Mon, 21 Feb 2022 13:33:08 +0100 Subject: [PATCH] Integrate Wallaby (#66) --- jest.config.js | 14 ++++++++++++-- packages/dataverse/src/utils/Emitter.test.ts | 2 +- .../shared/src/utils/numberRoundingUtils.test.ts | 12 ++++++------ wallaby.conf.js | 13 +++++++++++++ 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 wallaby.conf.js diff --git a/jest.config.js b/jest.config.js index 3676c98..12204ba 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,8 +15,18 @@ module.exports = { setupFiles: ['./theatre/shared/src/setupTestEnv.ts'], automock: false, transform: { - '^.+\\.tsx?$': 'esbuild-jest', - '^.+\\.js$': 'esbuild-jest', + '^.+\\.tsx?$': [ + 'esbuild-jest', + { + sourcemap: true, + }, + ], + '^.+\\.js$': [ + 'esbuild-jest', + { + sourcemap: true, + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], } diff --git a/packages/dataverse/src/utils/Emitter.test.ts b/packages/dataverse/src/utils/Emitter.test.ts index a2f2c4e..bf2cf31 100644 --- a/packages/dataverse/src/utils/Emitter.test.ts +++ b/packages/dataverse/src/utils/Emitter.test.ts @@ -1,6 +1,6 @@ import Emitter from './Emitter' -describe.only('DataVerse.Emitter', () => { +describe('DataVerse.Emitter', () => { it('should work', () => { const e: Emitter = new Emitter() e.emit('no one will see this') diff --git a/theatre/shared/src/utils/numberRoundingUtils.test.ts b/theatre/shared/src/utils/numberRoundingUtils.test.ts index 72e2f8c..316dac5 100644 --- a/theatre/shared/src/utils/numberRoundingUtils.test.ts +++ b/theatre/shared/src/utils/numberRoundingUtils.test.ts @@ -68,11 +68,11 @@ describe(`numberRoundingUtils()`, () => { sign ) } - for (let i = 0; i < 2000; i++) { - const from = toPrecision(getRandomNumber()) - const to = toPrecision(getRandomNumber()) + test(`roundestNumberBetween() => fuzzy`, () => { + for (let i = 0; i < 2000; i++) { + const from = toPrecision(getRandomNumber()) + const to = toPrecision(getRandomNumber()) - test(`roundestNumberBetween(${from}, ${to}) => fuzzy`, () => { const result = roundestNumberBetween(from, to) if (from < to) { if (result < from || result > to) { @@ -83,8 +83,8 @@ describe(`numberRoundingUtils()`, () => { throw new Error(`Invalid: ${to} ${from} ${result}`) } } - }) - } + } + }) }) describe(`roundestIntegerBetween`, () => { example(roundestIntegerBetween, [-1, 6], 0, {}) diff --git a/wallaby.conf.js b/wallaby.conf.js new file mode 100644 index 0000000..f01a67b --- /dev/null +++ b/wallaby.conf.js @@ -0,0 +1,13 @@ +module.exports = () => { + return { + autoDetect: true, + tests: [ + 'theatre/**/*.test.ts', + 'packages/dataverse/**/*.test.ts', + '!**/node_modules/**', + ], + testFramework: { + configFile: './jest.config.js', + }, + } +}