Skip to content

Commit 06b2dbd

Browse files
authored
Add AVA testing infra (GoogleChrome#110)
* wip * Get ava linting working. * Add tests for links.js
1 parent f44fdb7 commit 06b2dbd

10 files changed

+2083
-87
lines changed

.eslintrc.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
extends: ['./node_modules/gts', 'plugin:ava/recommended'],
3+
parserOptions: {
4+
sourceType: 'module',
5+
},
6+
rules: {
7+
// By default AVA will ignore folders or files with underscores in
8+
// their name. Since we have test paths like /site/_data/… we need to
9+
// disable this linter rule and enable these paths in our ava.config.js.
10+
'ava/no-ignored-test-files': 0,
11+
12+
// This rule checks to if your package requires devDependencies.
13+
// This rule is useful if you're publishing a package to npm but we're not,
14+
// we're building an application and we require devDependencies in a lot of
15+
// places. For our use case it makes sense to disable this rule.
16+
// Read more: https://github.com/mysticatea/eslint-plugin-node/issues/47
17+
'node/no-unpublished-require': 0,
18+
19+
// This rule looks at the node version in your package.json's engines field
20+
// to determine which ES features are allowed. Our engine field says we
21+
// support Node v12 which does not yet have support for modules. But we use
22+
// rollup to bundle our client-side JS and our config.js files for other
23+
// tools like ava and rollup support ESM.
24+
'node/no-unsupported-features/es-syntax': ['error', {
25+
'ignores': ['modules'],
26+
}]
27+
}
28+
};

.eslintrc.json

-9
This file was deleted.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Thumbs.db
99
.env
1010
.cache
1111

12+
# Code coverage generated files
13+
.nyc_output
14+
coverage
15+
1216
# Node modules and output
1317
node_modules
1418
dist

ava.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
files: ['tests/**/*'],
3+
// This needs to be turned on to let AVA use power-assert for enhanced
4+
// assertion messages.
5+
// Read more: https://github.com/avajs/ava/blob/master/docs/03-assertions.md#enhanced-assertion-messages
6+
babel: true,
7+
};

0 commit comments

Comments
 (0)