From ebbf7f9d30f117338b9b3e1f8d6d350c22a60da3 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Wed, 31 May 2023 18:34:42 +0300 Subject: [PATCH 1/2] fix default test script run. AG-22026 Squashed commit of the following: commit d2ab6ced5fd2fe24ef890bb08f64c07da816b999 Author: Slava Leleka Date: Wed May 31 18:26:15 2023 +0300 fix linter in test specs commit f605d545448258750bb54fed3d90df64dfe1cd41 Author: Slava Leleka Date: Wed May 31 18:20:00 2023 +0300 fix tests run commit 5a6e1352c48dfe0e24fdd378e0f23e7adb8c4a7b Author: Slava Leleka Date: Wed May 31 18:12:17 2023 +0300 add option to run rebuild for specific test commit 20ee952d463c9cf8bce999c001d09a6eaf85bcff Author: Slava Leleka Date: Wed May 31 17:53:44 2023 +0300 fix default test script run --- README.md | 8 ++++++++ bamboo-specs/test.yaml | 10 ++++------ scripts/test.js | 29 +++++++++++++++++++---------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a487a666e..08b3cdcaf 100644 --- a/README.md +++ b/README.md @@ -544,6 +544,14 @@ yarn test yarn test:qunit redirects --name ati-smarttag --gui ``` + For debugging purposes after some test is running in gui mode, + you may change your scriptlet/redirect code, and without stopping the server + run in new terminal: + + ```bash + yarn test:qunit scriptlets --name set-cookie --build + ``` + 1. Run all jest tests: ```bash diff --git a/bamboo-specs/test.yaml b/bamboo-specs/test.yaml index 346f854a2..337b1551b 100644 --- a/bamboo-specs/test.yaml +++ b/bamboo-specs/test.yaml @@ -33,18 +33,16 @@ Build: yarn install - # check compatibility table updates and build it + # build docs to lint them later + # 1. check compatibility table updates and build it yarn wiki:build-table - # build other wiki docs + # 2. build other wiki docs yarn wiki:build-docs - # lint docs - yarn lint:md - yarn test yarn build - # lint code. it should be run after yarn build + # lint code and docs. it should be run after yarn build yarn lint rm -rf node_modules diff --git a/scripts/test.js b/scripts/test.js index 25fa53597..ec10944b4 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -5,6 +5,7 @@ import { buildScriptlets, buildScriptletsList } from './build-scriptlets'; import { buildScriptletsFunc } from './build-funcs'; import { buildRedirectsMap } from './build-redirects-map'; import { + buildClick2Load, buildRedirectsFiles, buildRedirectsList, prebuildRedirects, @@ -42,6 +43,7 @@ const runGuiTest = async (type, name) => { const allBuildTestTasks = [ buildScriptletsAndRedirectsLists, buildScriptletsFunc, + buildClick2Load, buildRedirectsMap, prebuildRedirects, buildRedirectsFiles, @@ -78,12 +80,20 @@ const runSpecificTests = async (type, options) => { await runTasks(buildTasksMap[type]); const limitData = { type }; - const { name, gui } = options; + const { name, gui, build } = options; if (name) { limitData.name = name; } await buildTests(limitData); + // do not run tests for --build + if (build) { + if (gui) { + throw new Error('Cannot use --build with --gui'); + } + return; + } + // gui testing is available only for specific scriptlet or redirect if (gui && name) { await runGuiTest(type, name); @@ -94,17 +104,14 @@ const runSpecificTests = async (type, options) => { program .description('By default run all tests') - .action(async () => { - await runTasks(allBuildTestTasks); - await buildTests(); - await runQunitTests(); - }); - -program - .description('Just build tests files, no run') .option('--build', 'only build') - .action(async () => { + .action(async (options) => { + await runTasks(allBuildTestTasks); await buildTests(); + // if build option is set, then do not run tests + if (!options.build) { + await runQunitTests(); + } }); program @@ -112,6 +119,7 @@ program .command('scriptlets') .option('--name ', 'for specific scriptlet testing') .option('--gui', 'for gui testing, requires --name') + .option('--build', 'build sources; requires --name; cannot be used with --gui') .action(async (options) => { await runSpecificTests(SCRIPTLETS_TYPE, options); }); @@ -121,6 +129,7 @@ program .command('redirects') .option('--name ', 'for specific redirect testing') .option('--gui', 'for gui testing, requires --name') + .option('--build', 'build sources; requires --name; cannot be used with --gui') .action(async (options) => { await runSpecificTests(REDIRECTS_TYPE, options); }); From fdade013ec2d4b428d3be7c1e8c87355162ac283 Mon Sep 17 00:00:00 2001 From: Atlassian Bamboo Date: Wed, 31 May 2023 18:34:54 +0300 Subject: [PATCH 2/2] skipci: Automatic increment build number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2040c10c..42a54e5f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adguard/scriptlets", - "version": "1.9.30", + "version": "1.9.31", "description": "AdGuard's JavaScript library of Scriptlets and Redirect resources", "scripts": { "build": "babel-node scripts/build.js",