From dae755d486160251591920a03fd354cf313362d4 Mon Sep 17 00:00:00 2001 From: Philipp Rudloff Date: Sun, 2 Oct 2022 00:40:39 +0200 Subject: [PATCH] chore: fixes tests on Windows using Unix-style path (#1420) * chore: allows longer commit body Changes the commitlint configuration to allow commit bodies of any length. * chore: fixes tests on Windows using Unix-style path Fixes a test passing a Unix-style path to child_process.exec which failed on Windows by wrapping it in `path.resolve`. Fixes a test relying on some internal logic which only took Unix-style paths into account. Co-authored-by: Artem Zakharchenko --- commitlint.config.js | 1 + src/utils/internal/getCallFrame.ts | 2 +- test/msw-api/cli/init.test.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index 64b8bad72..651b7e54c 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,6 +1,7 @@ module.exports = { extends: ['@commitlint/config-conventional'], rules: { + 'body-max-line-length': [0, 'always', Infinity], 'footer-max-line-length': [1, 'always'], }, } diff --git a/src/utils/internal/getCallFrame.ts b/src/utils/internal/getCallFrame.ts index d1c6c49e7..4e297d2ee 100644 --- a/src/utils/internal/getCallFrame.ts +++ b/src/utils/internal/getCallFrame.ts @@ -1,5 +1,5 @@ // Ignore the source files traces for local testing. -const SOURCE_FRAME = /\/msw\/src\/(.+)/ +const SOURCE_FRAME = /[\/\\]msw[\/\\]src[\/\\](.+)/ const BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](umd|esm|iief|cjs)[\/\\]|^[^\/\\]*$/ diff --git a/test/msw-api/cli/init.test.ts b/test/msw-api/cli/init.test.ts index 4a943e7fc..dd49c2d0c 100644 --- a/test/msw-api/cli/init.test.ts +++ b/test/msw-api/cli/init.test.ts @@ -161,7 +161,7 @@ test('does not produce eslint errors or warnings', async () => { expect(init.stderr).toEqual('') const eslint = await promisifyChildProcess( - exec(`node_modules/.bin/eslint ${fsMock.resolve()}`), + exec(path.resolve(`node_modules/.bin/eslint ${fsMock.resolve()}`)), ) expect(eslint.stdout).toEqual('') expect(eslint.stderr).toEqual('')