Skip to content

Commit 2e9f04c

Browse files
authored
Revert "refactor: remove .js ext from ALL local imports across the codebase (#361)" (#363)
This reverts commit db3b348.
1 parent db3b348 commit 2e9f04c

115 files changed

Lines changed: 400 additions & 416 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nodejs.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,25 @@ on:
44
push:
55
branches:
66
- develop
7-
- test
87
pull_request:
98

109
jobs:
1110
build:
1211
runs-on: 'ubuntu-latest'
1312

14-
1513
steps:
16-
- name: 'Checkout Project'
17-
uses: 'actions/checkout@v4'
18-
1914
- name: Setup Node.js environment
2015
uses: actions/setup-node@v3
2116
with:
2217
node-version: '16.15'
23-
cache: 'yarn'
2418

25-
- name: Install dependencies
26-
run: yarn install --immutable
19+
- name: 'Checkout Project'
20+
uses: 'actions/checkout@v3'
21+
with:
22+
fetch-depth: 1
2723

28-
- name: Lint code
29-
run: yarn lint
24+
- name: Install Dependencies and lint code
25+
run: yarn install && yarn lint
3026

3127
- name: Start MongoDB
3228
uses: supercharge/mongodb-github-action@1.8.0
@@ -48,8 +44,8 @@ jobs:
4844
run: |
4945
docker container restart mongodb
5046
51-
- name: Run tests
52-
run: yarn test --ci
47+
- name: Build and run tests
48+
run: yarn test
49+
env:
50+
NODE_OPTIONS: --experimental-vm-modules
5351

54-
- name: Build files/check types
55-
run: yarn build-release --noEmit

jest.config.cjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
module.exports = {
2-
transform: {
3-
'^.+\\.tsx?$': 'ts-jest'
4-
},
5-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
2+
preset: 'ts-jest',
63
testEnvironment: 'node',
7-
testPathIgnorePatterns: ['/node_modules/', './build/'],
84
testMatch: [
9-
'<rootDir>/**/__tests__/*.ts'
5+
'<rootDir>/build/**/__tests__/*.js'
106
]
117
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"scripts": {
6767
"lint": "yarn ts-standard",
6868
"fix": "yarn ts-standard --fix",
69-
"test": "jest --runInBand",
69+
"test": "yarn build && cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand",
7070
"build": "tsc -p tsconfig.json",
7171
"build-release": "tsc -p tsconfig.release.json",
7272
"clean": "tsc -b --clean && rm -rf build/*",

src/GradeUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getScale, GradeScales, GradeScalesTypes } from '@openbeta/sandbag'
22
import isoCountries from 'i18n-iso-countries'
3-
import { DisciplineType, ClimbGradeContextType } from './db/ClimbTypes'
3+
import { DisciplineType, ClimbGradeContextType } from './db/ClimbTypes.js'
44

55
/**
66
* Grade systems have minor variations between countries. gradeContext is a

src/__tests__/areas.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ApolloServer } from 'apollo-server'
22
import muuid from 'uuid-mongodb'
33
import { jest } from '@jest/globals'
4-
import MutableAreaDataSource from '../model/MutableAreaDataSource'
5-
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource'
6-
import { AreaType } from '../db/AreaTypes'
7-
import { OrgType, OrganizationType, OrganizationEditableFieldsType } from '../db/OrganizationTypes'
8-
import { queryAPI, setUpServer } from '../utils/testUtils'
9-
import { muuidToString } from '../utils/helpers'
4+
import MutableAreaDataSource from '../model/MutableAreaDataSource.js'
5+
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource.js'
6+
import { AreaType } from '../db/AreaTypes.js'
7+
import { OrgType, OrganizationType, OrganizationEditableFieldsType } from '../db/OrganizationTypes.js'
8+
import { queryAPI, setUpServer } from '../utils/testUtils.js'
9+
import { muuidToString } from '../utils/helpers.js'
1010

1111
jest.setTimeout(60000)
1212

src/__tests__/gradeUtils.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import { DisciplineType } from '../db/ClimbTypes'
2-
import { sanitizeDisciplines, createGradeObject, gradeContextToGradeScales } from '../GradeUtils'
3-
4-
beforeAll(() => {
5-
console.warn = jest.fn()
6-
})
7-
8-
afterAll(() => {
9-
jest.mocked(console.warn).mockReset()
10-
})
1+
import { DisciplineType } from '../db/ClimbTypes.js'
2+
import { sanitizeDisciplines, createGradeObject, gradeContextToGradeScales } from '../GradeUtils.js'
113

124
describe('Test grade utilities', () => {
135
it('sanitizes bad discipline object', () => {

src/__tests__/history.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { ApolloServer } from 'apollo-server'
22
import muuid from 'uuid-mongodb'
33
import { jest } from '@jest/globals'
4-
import MutableAreaDataSource from '../model/MutableAreaDataSource'
5-
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource'
6-
import MutableClimbDataSource from '../model/MutableClimbDataSource'
7-
import { AreaType } from '../db/AreaTypes'
8-
import { OrgType, OrganizationType } from '../db/OrganizationTypes'
9-
import { muuidToString } from '../utils/helpers'
10-
import { queryAPI, setUpServer } from '../utils/testUtils'
4+
import MutableAreaDataSource from '../model/MutableAreaDataSource.js'
5+
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource.js'
6+
import MutableClimbDataSource from '../model/MutableClimbDataSource.js'
7+
import { AreaType } from '../db/AreaTypes.js'
8+
import { OrgType, OrganizationType } from '../db/OrganizationTypes.js'
9+
import { muuidToString } from '../utils/helpers.js'
10+
import { queryAPI, setUpServer } from '../utils/testUtils.js'
1111

1212
jest.setTimeout(60000)
1313

src/__tests__/organizations.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { ApolloServer } from 'apollo-server'
22
import muuid from 'uuid-mongodb'
33
import { jest } from '@jest/globals'
4-
import MutableAreaDataSource from '../model/MutableAreaDataSource'
5-
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource'
6-
import { AreaType } from '../db/AreaTypes'
7-
import { OrgType, OrganizationType, OperationType, OrganizationEditableFieldsType } from '../db/OrganizationTypes'
8-
import { changelogDataSource } from '../model/ChangeLogDataSource'
9-
import { queryAPI, setUpServer } from '../utils/testUtils'
10-
import { muuidToString } from '../utils/helpers'
4+
import MutableAreaDataSource from '../model/MutableAreaDataSource.js'
5+
import MutableOrganizationDataSource from '../model/MutableOrganizationDataSource.js'
6+
import { AreaType } from '../db/AreaTypes.js'
7+
import { OrgType, OrganizationType, OperationType, OrganizationEditableFieldsType } from '../db/OrganizationTypes.js'
8+
import { changelogDataSource } from '../model/ChangeLogDataSource.js'
9+
import { queryAPI, setUpServer } from '../utils/testUtils.js'
10+
import { muuidToString } from '../utils/helpers.js'
1111
import { validate as validateMuuid } from 'uuid'
1212

1313
jest.setTimeout(60000)

src/__tests__/ticks.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ApolloServer } from 'apollo-server'
22
import muuid from 'uuid-mongodb'
33
import { jest } from '@jest/globals'
4-
import { queryAPI, setUpServer } from '../utils/testUtils'
5-
import { muuidToString } from '../utils/helpers'
6-
import { TickInput } from '../db/TickTypes'
7-
import TickDataSource from '../model/TickDataSource'
8-
import UserDataSource from '../model/UserDataSource'
9-
import { UpdateProfileGQLInput } from '../db/UserTypes'
4+
import { queryAPI, setUpServer } from '../utils/testUtils.js'
5+
import { muuidToString } from '../utils/helpers.js'
6+
import { TickInput } from '../db/TickTypes.js'
7+
import TickDataSource from '../model/TickDataSource.js'
8+
import UserDataSource from '../model/UserDataSource.js'
9+
import { UpdateProfileGQLInput } from '../db/UserTypes.js'
1010

1111
jest.setTimeout(60000)
1212

src/auth/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import permissions from './permissions'
2-
import { createContext } from './middleware'
1+
import permissions from './permissions.js'
2+
import { createContext } from './middleware.js'
33
export { permissions, createContext }

0 commit comments

Comments
 (0)