Skip to content

tests: add eslintrc jest env and remove all the env comments #13954

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

Merged
merged 4 commits into from
May 6, 2022
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions build/test/plugins/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
env: {
jest: true,
},
};
3 changes: 0 additions & 3 deletions build/test/plugins/inline-fs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/


/* eslint-env jest */

import fs from 'fs';
import path from 'path';

Expand Down
11 changes: 11 additions & 0 deletions clients/test/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
env: {
jest: true,
},
};
2 changes: 0 additions & 2 deletions clients/test/extension/popup-test-pptr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
'use strict';

/* eslint-env jest */

const path = require('path');
const puppeteer = require('puppeteer-core');
const {getChromePath} = require('chrome-launcher');
Expand Down
2 changes: 0 additions & 2 deletions clients/test/extension/settings-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
'use strict';

/* eslint-env jest */

const SettingsController = require('../../extension/scripts/settings-controller.js');
const defaultConfig = require('../../../lighthouse-core/config/default-config.js');
const format = require('../../../shared/localization/format.js');
Expand Down
2 changes: 0 additions & 2 deletions clients/test/lightrider/lightrider-entry-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {runLighthouseInLR} from '../../lightrider/lightrider-entry.js';
import Runner from '../../../lighthouse-core/runner.js';
import LHError from '../../../lighthouse-core/lib/lh-error.js';

/* eslint-env jest */

describe('lightrider-entry', () => {
describe('#runLighthouseInLR', () => {
it('returns a runtimeError LHR when lighthouse throws a runtimeError', async () => {
Expand Down
11 changes: 11 additions & 0 deletions docs/recipes/integration-test/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
env: {
jest: true,
},
};
2 changes: 0 additions & 2 deletions docs/recipes/integration-test/example-lh-auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

/* eslint-env jest */
/* eslint-disable new-cap */

/**
Expand Down
11 changes: 11 additions & 0 deletions lighthouse-cli/test/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
env: {
jest: true,
},
};
2 changes: 0 additions & 2 deletions lighthouse-cli/test/cli/bin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/* eslint-env jest */

import fs from 'fs';

import {jest} from '@jest/globals';
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-cli/test/cli/cli-flags-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/* eslint-env jest */

import {strict as assert} from 'assert';
import fs from 'fs';

Expand Down
2 changes: 0 additions & 2 deletions lighthouse-cli/test/cli/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/* eslint-env jest */

import {strict as assert} from 'assert';
import {spawnSync} from 'child_process';

Expand Down
2 changes: 0 additions & 2 deletions lighthouse-cli/test/cli/printer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/* eslint-env jest */

import {strict as assert} from 'assert';
import fs from 'fs';

Expand Down
2 changes: 0 additions & 2 deletions lighthouse-cli/test/cli/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/* eslint-env jest */

import {strict as assert} from 'assert';
import path from 'path';
import fs from 'fs';
Expand Down
1 change: 0 additions & 1 deletion lighthouse-cli/test/fixtures/static-server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import fetch from 'node-fetch';

import {server} from './static-server.js';

/* eslint-env jest */

describe('Server', () => {
beforeAll(async () => {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-cli/test/smokehouse/version-check-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import {chromiumVersionCheck, compareVersions} from './version-check.js';

/* eslint-env jest */

describe('version check', () => {
it('compareVersions', async () => {
expect(compareVersions([100, 0, 0, 0], [100, 0, 0, 0])).toBe(0);
Expand Down
3 changes: 3 additions & 0 deletions lighthouse-core/test/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/

module.exports = {
env: {
jest: true,
},
rules: {
// TODO(esmodules): move to root eslint when all code is ESM
// or when this is resolved: https://github.com/import-js/eslint-plugin-import/issues/2214
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-allowed-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-allowed-attr audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-required-attr audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-children.js';

/* eslint-env jest */

describe('Accessibility: aria-required-children audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-parent.js';

/* eslint-env jest */

describe('Accessibility: aria-required-parent audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/aria-roles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-roles.js';

/* eslint-env jest */

describe('Accessibility: aria-roles audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-valid-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-valid-attr audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-valid-attr-value.js';

/* eslint-env jest */

describe('Accessibility: aria-valid-attr-value audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/axe-audit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import AxeAudit from '../../../audits/accessibility/axe-audit.js';
import Accesskeys from '../../../audits/accessibility/accesskeys.js';
import format from '../../../../shared/localization/format.js';

/* eslint-env jest */

describe('Accessibility: axe-audit', () => {
describe('audit()', () => {
it('generates audit output using subclass meta', () => {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/button-name-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/button-name.js';

/* eslint-env jest */

describe('Accessibility: button-name audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/bypass-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/bypass.js';

/* eslint-env jest */

describe('Accessibility: bypass audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/color-contrast.js';

/* eslint-env jest */

describe('Accessibility: color-contrast audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/definition-list.js';

/* eslint-env jest */

describe('Accessibility: definition-list audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/dlitem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/dlitem.js';

/* eslint-env jest */

describe('Accessibility: dlitem audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/document-title.js';

/* eslint-env jest */

describe('Accessibility: document-title audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/frame-title-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/frame-title.js';

/* eslint-env jest */

describe('Accessibility: frame-title audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/html-has-lang.js';

/* eslint-env jest */

describe('Accessibility: html-has-lang audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/html-lang-valid.js';

/* eslint-env jest */

describe('Accessibility: html-lang-valid audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/image-alt-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/image-alt.js';

/* eslint-env jest */

describe('Accessibility: image-alt audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/input-image-alt.js';

/* eslint-env jest */

describe('Accessibility: input-image-alt audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/label-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/label.js';

/* eslint-env jest */

describe('Accessibility: label audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/link-name-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/link-name.js';

/* eslint-env jest */

describe('Accessibility: link-name audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/list.js';

/* eslint-env jest */

describe('Accessibility: list audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/listitem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/listitem.js';

/* eslint-env jest */

describe('Accessibility: listitem audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/meta-refresh.js';

/* eslint-env jest */

describe('Accessibility: meta-refresh audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/meta-viewport.js';

/* eslint-env jest */

describe('Accessibility: meta-viewport audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/test/audits/accessibility/object-alt-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/object-alt.js';

/* eslint-env jest */

describe('Accessibility: object-alt audit', () => {
it('generates an audit output', () => {
const artifacts = {
Expand Down
Loading