Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ module.exports = {
{
files: ['examples/**/*'],
rules: {
'import/no-unresolved': ['error', {ignore: ['^react-native$']}],
'import/order': 'off',
'no-restricted-imports': 'off',
Copy link
Contributor Author

@mrazauskas mrazauskas Sep 30, 2022

Choose a reason for hiding this comment

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

Without turning this off ESLint is pushing to use graceful-fs.

},
},
{
Expand Down
1 change: 0 additions & 1 deletion examples/angular/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {describe, expect, it, jest} from '@jest/globals';

import {AppComponent} from './app.component';
import {DataService} from './shared/data.service';

Expand Down
1 change: 0 additions & 1 deletion examples/angular/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from '@angular/core';

import {DataService} from './shared/data.service';

@Component({
Expand Down
1 change: 0 additions & 1 deletion examples/angular/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppComponent} from './app.component';

@NgModule({
Expand Down
1 change: 0 additions & 1 deletion examples/angular/shared/data.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {TestBed} from '@angular/core/testing';
import {beforeEach, describe, expect, it, jest} from '@jest/globals';

import {DataService} from './data.service';
import {SubService} from './sub.service';

Expand Down
1 change: 0 additions & 1 deletion examples/angular/shared/data.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Injectable} from '@angular/core';

import {SubService} from './sub.service';

@Injectable()
Expand Down
1 change: 0 additions & 1 deletion examples/angular/shared/sub.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {TestBed} from '@angular/core/testing';
import {beforeEach, describe, expect, it} from '@jest/globals';

import {SubService} from './sub.service';

describe('Service: SubService', () => {
Expand Down
3 changes: 1 addition & 2 deletions examples/enzyme/__tests__/CheckboxWithLabel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import Enzyme, {shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import CheckboxWithLabel from '../CheckboxWithLabel';

Enzyme.configure({adapter: new Adapter()});

import CheckboxWithLabel from '../CheckboxWithLabel';

it('CheckboxWithLabel changes the text after click', () => {
// Render a checkbox with label in the document
const checkbox = shallow(<CheckboxWithLabel labelOn="On" labelOff="Off" />);
Expand Down
9 changes: 3 additions & 6 deletions examples/mongodb/mongo-environment.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// mongo-environment.js
const NodeEnvironment = require('jest-environment-node').default;

const path = require('path');

const fs = require('fs');
import fs from 'fs';
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be ESM?

Copy link
Member

Choose a reason for hiding this comment

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

It probably doesn't hurt, tho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was hard to look at require('jest-environment-node').default above. That’s the only reason. I can revert.

Copy link
Member

Choose a reason for hiding this comment

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

Nah, it's fine. Sorta surprised it works tho - the default in CJS is different from native ESM default. Can use const {TestEnvironment} = require('jest-environment-jsdom')

import path from 'path';
import NodeEnvironment from 'jest-environment-node';

const globalConfigPath = path.join(__dirname, 'globalConfig.json');

Expand Down
9 changes: 3 additions & 6 deletions examples/mongodb/setup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// setup.js
const path = require('path');

const fs = require('fs');

const {MongoMemoryServer} = require('mongodb-memory-server');
import fs from 'fs';
import path from 'path';
import {MongoMemoryServer} from 'mongodb-memory-server';

const globalConfigPath = path.join(__dirname, 'globalConfig.json');

Expand Down
6 changes: 2 additions & 4 deletions examples/mongodb/teardown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// teardown.js
const path = require('path');

const fs = require('fs');
import fs from 'fs';
import path from 'path';

const globalConfigPath = path.join(__dirname, 'globalConfig.json');

Expand Down
2 changes: 1 addition & 1 deletion examples/react-native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @flow
*/

import Intro from './Intro';
import React, {Component} from 'react';
import {AppRegistry} from 'react-native';
import Intro from './Intro';

class App extends Component<{}> {
render() {
Expand Down
1 change: 0 additions & 1 deletion examples/react/__tests__/CheckboxWithLabel-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2004-present Facebook. All Rights Reserved.

import {createRef} from 'react';

import * as TestUtils from 'react-dom/test-utils';
import CheckboxWithLabel from '../CheckboxWithLabel';

Expand Down
2 changes: 1 addition & 1 deletion examples/snapshot/__tests__/clock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

'use strict';

import Clock from '../Clock';
import renderer from 'react-test-renderer';
import Clock from '../Clock';

jest.useFakeTimers();
Date.now = jest.fn(() => 1482363367071);
Expand Down
2 changes: 1 addition & 1 deletion examples/snapshot/__tests__/link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

'use strict';

import Link from '../Link';
import renderer from 'react-test-renderer';
import Link from '../Link';

it('renders correctly', () => {
const tree = renderer
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion examples/typescript/__tests__/CheckboxWithLabel-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import * as React from 'react';
import * as TestUtils from 'react-dom/test-utils';

const CheckboxWithLabel = require('../CheckboxWithLabel').default;

it('CheckboxWithLabel changes the text after click', () => {
Expand Down
7 changes: 3 additions & 4 deletions examples/typescript/__tests__/calc.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

import {jest} from '@jest/globals';

import Memory from '../memory';
import Memory from '../Memory';
import makeCalc from '../calc';
import sub from '../sub';
import sum from '../sum';
import makeCalc from '../calc';

jest.mock('../memory');
jest.mock('../Memory');
jest.mock('../sub');
jest.mock('../sum');

Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/calc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Memory from './Memory';
import sub from './sub';
import sum from './sum';
import Memory from './memory';

type Op = 'MemoryAdd' | 'MemoryClear' | 'MemorySub' | 'Sub' | 'Sum';

Expand Down