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

Run docs/test.html tests on Node.js #42

Merged
merged 5 commits into from
Sep 6, 2021

Conversation

mjethani
Copy link
Contributor

@mjethani mjethani commented Sep 5, 2021

This patch brings the tests in docs/test.html to Node.js.

There's a tests.yml file that runs the tests on GitHub.

README.md includes a badge and brief development instructions.

More in inline comments.

jobs:
build:

runs-on: ubuntu-latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more to this integration. For example, when I open a pull request, it should run the tests on the pull request. I'll look into this a little later.

}

const resultTemplateGood = ' Success: checkPublicSuffix({{a}}, {{b}})';
const resultTemplateBad = '\u2757 Failure: got {{r}} instead: checkPublicSuffix({{a}}, {{b}})';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing "❗️" in case of failure.

checkAll();
console.log();

console.log(`Finished with ${errorCount} errors ${errorCount === 0 ? '\ud83c\udf89' : '\u2620\ufe0f'}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing "🎉" and "☠️" in the cases of success and failure respectively.

console.log();

if ( errorCount > 0 ) {
process.exit(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-zero exit code in case of any failures.

}
}

// This function is a verbatim copy of the one in docs/test.html
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an exact copy of the code in docs/test.html. It should be easy to keep them in sync. In the end I expect that this file will become redundant as we have better tests in tests/*.js eventually.

@gorhill gorhill merged commit 795c884 into gorhill:master Sep 6, 2021
@mjethani mjethani deleted the docs-test-node branch September 6, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants