Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move <root>/tests/resources folder to <root>/resources #1096

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
tests/resources/keys.mjs
resources/keys.mjs

tests/**/reference/**/*
build/tests/**/*
build/resources/*

__test__/__mocks__/tests/**/reference/**/*
__test__/build/tests/**/*
480 changes: 240 additions & 240 deletions __test__/__snapshots__/createAllTests.test.js.snap

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions __test__/__snapshots__/createReviewPages.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -570,7 +570,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -3542,7 +3542,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -4664,7 +4664,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -7251,7 +7251,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -7708,7 +7708,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -10680,7 +10680,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -11802,7 +11802,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -14389,7 +14389,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -14846,7 +14846,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -17818,7 +17818,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -18940,7 +18940,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -21527,7 +21527,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -21984,7 +21984,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -24956,7 +24956,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -26078,7 +26078,7 @@ exports[`review pages creation runs createReviewPages successfully for all test

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -28638,7 +28638,7 @@ exports[`review pages creation runs createReviewPages successfully for v1 tests

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -31653,7 +31653,7 @@ exports[`review pages creation runs createReviewPages successfully for v2 tests

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -32136,7 +32136,7 @@ exports[`review pages creation runs createReviewPages successfully for v2 tests

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down Expand Up @@ -33290,7 +33290,7 @@ exports[`review pages creation runs createReviewPages successfully for v2 tests

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down
4 changes: 3 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ export default [
ignores: [
'tests/**/reference/**/*',
'build/tests/**/*',
'build/resources/*',

// keys are manually parsed in process-test-directory.js and depend on format
'tests/resources/keys.mjs',
'resources/keys.mjs',

// Automated tests related resources
'__test__/__mocks__/tests/**/reference/**/*',
Expand Down
8 changes: 4 additions & 4 deletions lib/data/process-test-directory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const processTestDirectory = async config => {
const testsDirectory = config?.testsDirectory ?? path.join(rootDirectory, 'tests');
const testPlanDirectory = path.join(testsDirectory, testPlanName);

const resourcesDirectory = path.join(rootDirectory, 'tests', 'resources');
const resourcesDirectory = path.join(rootDirectory, 'resources');
const supportJsonFilePath = path.join(rootDirectory, 'tests', 'support.json');
const commandsJsonFilePath = path.join(rootDirectory, 'tests', 'commands.json');
const testsCsvFilePath = path.join(testPlanDirectory, 'data', 'tests.csv');
Expand All @@ -84,10 +84,10 @@ const processTestDirectory = async config => {
'tests',
`tests/${testPlanName}`,
`tests/${testPlanName}/**`,
'tests/resources',
'tests/resources/*',
'tests/support.json',
'tests/commands.json',
'tests/support.json',
'resources',
'resources/*',
].join(','),
});

Expand Down
6 changes: 3 additions & 3 deletions lib/data/process-test-directory/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Utils {
this.errorCount += 1;

if (this.testFormatVersion === 1) {
this.errors += `[Command]: The key reference "${key}" found in "tests/${this._testPlanName}/data/commands.csv" for "test id ${testId}: ${task}" is invalid. Command may not be defined in "tests/resources/keys.mjs".\n`;
this.errors += `[Command]: The key reference "${key}" found in "tests/${this._testPlanName}/data/commands.csv" for "test id ${testId}: ${task}" is invalid. Command may not be defined in "resources/keys.mjs".\n`;
} else {
this.errors += `[Command]: The key reference "${key}" found in "tests/${this._testPlanName}/data/${atKey}-commands.csv" for "test id ${testId}" is invalid. Command may not be defined in "tests/commands.json".\n`;
}
Expand Down Expand Up @@ -257,7 +257,6 @@ class Utils {
name: this._testPlanName,
entries: testPlanUpdate.filter({ glob: 'reference{,/**}' }).record.entries,
},
{ name: 'resources', ...this._resourcesRecord.record },
{ name: 'support.json', ...this._supportJsonRecord.record },
];

Expand All @@ -271,6 +270,7 @@ class Utils {
name: 'tests',
entries: testsFolderEntries,
},
{ name: 'resources', ...this._resourcesRecord.record },
],
});
}
Expand Down Expand Up @@ -474,7 +474,7 @@ ${exampleReferences}
${scriptsJs}
</script>
<script type="module">
import { initialize, verifyATBehavior, displayTestPageAndInstructions } from "../resources/aria-at-harness.mjs";
import { initialize, verifyATBehavior, displayTestPageAndInstructions } from "../../resources/aria-at-harness.mjs";

${filesPromiseJs}
</script>
Expand Down
6 changes: 3 additions & 3 deletions lib/data/process-test-directory/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const processTestDirectory = async config => {
const testsDirectory = config?.testsDirectory ?? path.join(rootDirectory, 'tests');
const testPlanDirectory = path.join(testsDirectory, testPlanName);

const resourcesDirectory = path.join(rootDirectory, 'tests', 'resources');
const resourcesDirectory = path.join(rootDirectory, 'resources');
const supportJsonFilePath = path.join(rootDirectory, 'tests', 'support.json');
const atCommandsCsvFilePath = path.join(testPlanDirectory, 'data', 'commands.csv');
const testsCsvFilePath = path.join(testPlanDirectory, 'data', 'testsV1.csv');
Expand All @@ -80,9 +80,9 @@ const processTestDirectory = async config => {
'tests',
`tests/${testPlanName}`,
`tests/${testPlanName}/**`,
'tests/resources',
'tests/resources/*',
'tests/support.json',
'resources',
'resources/*',
].join(','),
});

Expand Down
2 changes: 1 addition & 1 deletion lib/data/templates/collected-test.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function renderHTML(test, testFileName) {
</head>
<body>
<script type="module">
import {loadCollectedTestAsync} from "../resources/aria-at-harness.mjs";
import {loadCollectedTestAsync} from "../../resources/aria-at-harness.mjs";
loadCollectedTestAsync(new URL(location + "/..").pathname, "${testFileName}");
</script>
</body>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="help" href="https://w3c.github.io/aria/#ARIA-ROLE" />
<link rel="help" href="https://w3c.github.io/aria/#ARIA-ATTRIBUTE" />
<script type="module">
import { verifyATBehavior, displayTestPageAndInstructions } from "../resources/aria-at-harness.mjs";
import { verifyATBehavior, displayTestPageAndInstructions } from "../../resources/aria-at-harness.mjs";

verifyATBehavior({

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions scripts/test-reviewer/createReviewPages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import getScriptsData from './getScriptsData.mjs';
import getCollectedTestsData from './getCollectedTestsData.mjs';
import processCollectedTests from './processCollectedTests.mjs';
import { generatePatternPages, generateIndexPage } from './generateReviewPages.mjs';
import { commandsAPI as CommandsAPI } from '../../tests/resources/at-commands.mjs';
import { commandsAPI as CommandsAPI } from '../../resources/at-commands.mjs';
import { unescapeHTML } from './utils.mjs';

/**
Expand Down Expand Up @@ -68,7 +68,6 @@ export function createReviewPages(config) {

// Do nothing
if (!stat.isDirectory()) return;
if (directory === 'resources') return;

// Will continue if TARGET_TEST_PLAN is not set
if (TARGET_TEST_PLAN && directory !== TARGET_TEST_PLAN) return;
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-reviewer/review-template.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

</style>
<script type="module">
import {TestWindow} from '../../tests/resources/aria-at-test-window.mjs';
import {TestWindow} from '../../resources/aria-at-test-window.mjs';

function numberTests(value) {
let testNumber = 0;
Expand Down
Loading