From 7576e8c20226bb799fb451ba802f90c8909304db Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Mon, 21 Oct 2019 22:27:25 -0300 Subject: [PATCH 1/4] test-api: Fail fast if .only is used --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b1ccdbf0..6f4a83af 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -80,7 +80,7 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless + yarn test-api --headless --forbid-only displayName: 'Linux Integration tests' - job: macOS_IntegrationTests @@ -97,7 +97,7 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless + yarn test-api --headless --forbid-only displayName: 'MacOS Integration tests' - job: Release From 51ef0d0680e53d61836bf85e14acea322df312fa Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Tue, 22 Oct 2019 03:00:18 +0000 Subject: [PATCH 2/4] Update test-unit to allow double dash args --- bin/test.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/test.js b/bin/test.js index 775ec004..760908a3 100644 --- a/bin/test.js +++ b/bin/test.js @@ -15,15 +15,22 @@ let testFiles = [ './out/**/*test.js' ]; -// ability to inject particular test files via -// yarn test [testFileA testFileB ...] +let flagArgs = []; + if (process.argv.length > 2) { - testFiles = process.argv.slice(2); + const args = process.argv.slice(2); + flagArgs = args.filter(e => e.startsWith('--')); + // ability to inject particular test files via + // yarn test [testFileA testFileB ...] + files = args.filter(e => !e.startsWith('--')); + if(files.length){ + testFiles = files; + } } const run = cp.spawnSync( path.resolve(__dirname, '../node_modules/.bin/mocha'), - testFiles, + [...testFiles, ...flagArgs], { cwd: path.resolve(__dirname, '..'), env, @@ -31,4 +38,4 @@ const run = cp.spawnSync( } ); -process.exit(run.status); \ No newline at end of file +process.exit(run.status); From 5c2479944ec865f4df2bb33935f32af4ba395563 Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Tue, 22 Oct 2019 03:00:40 +0000 Subject: [PATCH 3/4] Ensure test-unit fails fast if .only present --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f4a83af..a58f7fe0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint @@ -38,7 +38,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint @@ -56,7 +56,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint From 5e2001f4b57393475d171b2b802e300782cfb7d6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 22 Oct 2019 07:14:32 -0700 Subject: [PATCH 4/4] Space out if --- bin/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/test.js b/bin/test.js index 760908a3..3b08d4a1 100644 --- a/bin/test.js +++ b/bin/test.js @@ -23,7 +23,7 @@ if (process.argv.length > 2) { // ability to inject particular test files via // yarn test [testFileA testFileB ...] files = args.filter(e => !e.startsWith('--')); - if(files.length){ + if (files.length) { testFiles = files; } }