From dd436453dad43ab06699ed98dc1f547ea45265bd Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Thu, 18 Jun 2020 09:55:20 -0600 Subject: [PATCH] tests: test the examples using local version of axe --- .circleci/config.yml | 11 ++++++----- doc/examples/test-examples.js | 12 ++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0134cd0db7..2fbc6acd7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,7 +74,7 @@ jobs: - checkout - <<: *restore_dependency_cache_unix - run: npm run test - + # Run the test suite in IE in windows test_win: <<: *defaults @@ -83,7 +83,7 @@ jobs: - checkout # npm i or restore cache - <<: *restore_dependency_cache_win - # install selenium + # install selenium - run: | choco install selenium-ie-driver --version 3.141.5 export PATH=/c/tools/selenium:$PATH @@ -91,8 +91,8 @@ jobs: # build `axe` - run: npm run build # get fixtures ready for running tests - - run: npx grunt testconfig - - run: npx grunt fixture + - run: npx grunt testconfig + - run: npx grunt fixture # run IE webdriver tests - run: npx grunt connect test-webdriver:ie # test examples @@ -107,6 +107,7 @@ jobs: steps: - checkout - <<: *restore_dependency_cache_unix + - run: npm run build - run: npm run test:examples # Test locale files @@ -191,7 +192,7 @@ workflows: requires: - dependencies_unix - lint - # Run IE/ Windows test on all commits + # Run IE/ Windows test on all commits - test_win: requires: - dependencies_win diff --git a/doc/examples/test-examples.js b/doc/examples/test-examples.js index 87d2576149..6495a2c756 100644 --- a/doc/examples/test-examples.js +++ b/doc/examples/test-examples.js @@ -8,8 +8,16 @@ const exampleDirs = readdirSync(__dirname) const config = { stdio: 'inherit', shell: true }; // run npm install in parallel -function install(dir) { - return execa('npm install', { cwd: dir, ...config }); +async function install(dir) { + await execa('npm install', { cwd: dir, ...config }); + + // override the package version of axe-core with the local version. + // this allows the examples to stay examples while allowing us to + // test them against our changes + return await execa('npm install --no-save file:..\\/..\\/..\\/', { + cwd: dir, + ...config + }); } // run tests synchronously so we can see which one threw an error