diff --git a/.circleci/config.yml b/.circleci/config.yml index 8020cabbef..8ed7e05008 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -240,16 +240,32 @@ jobs: - <<: *restore_dependency_cache_unix - run: npm run test:rule-help-version - # Test node API + # Test jsdom API + test_jsdom: + <<: *defaults + <<: *unix_box + steps: + - checkout + - <<: *restore_dependency_cache_unix + - <<: *restore_build + - run: npm run test:jsdom + + # Test node versions test_node: + parameters: + node-version: + type: string <<: *defaults <<: *unix_box steps: - checkout - <<: *restore_dependency_cache_unix - <<: *restore_build + - node/install: + node-version: << parameters.node-version >> - run: npm run test:node + # Release a "next" version next_release: <<: *defaults @@ -360,9 +376,15 @@ workflows: - test_rule_help_version: requires: - build_unix + - test_jsdom: + requires: + - build_unix - test_node: requires: - build_unix + matrix: + parameters: + node-version: ["16.9.0", "18.17.1"] # Verify the sri history is correct - verify_sri: requires: @@ -385,6 +407,7 @@ workflows: - test_virtual_rules - build_api_docs - test_rule_help_version + - test_jsdom - test_node - verify_sri filters: @@ -403,6 +426,7 @@ workflows: - test_virtual_rules - build_api_docs - test_rule_help_version + - test_jsdom - test_node filters: branches: diff --git a/package.json b/package.json index 878bf3d12c..a0429e55bc 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,8 @@ "test:locales": "mocha test/test-locales.js", "test:virtual-rules": "mocha test/test-virtual-rules.js", "test:rule-help-version": "mocha test/test-rule-help-version.js", - "test:node": "mocha test/node/*.js", + "test:node": "mocha test/node/node.js", + "test:jsdom": "mocha test/node/jsdom.js", "version": "echo \"use 'npm run release' to bump axe-core version\" && exit 1", "release": "git fetch origin --tags --force && standard-version -a", "rule-gen": "node build/rule-generator", diff --git a/test/node/node.js b/test/node/node.js new file mode 100644 index 0000000000..b48422a0a8 --- /dev/null +++ b/test/node/node.js @@ -0,0 +1,79 @@ +// this file is purposefully written without mocha and in non-es6 syntax in order +// to be compatible with node 4+ + +var axe = require('../../'); +var assert = require('assert'); +var exec = require('child_process').exec; + +var domStr = + '' + + '' + + '
' + + '' + + '' + + '