Skip to content

Commit

Permalink
prevent swc from transpiling js to "fix" imports that are broken
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdean-digicatapult committed Oct 25, 2024
1 parent cab422b commit 801e96b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"scripts": {
"test": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts",
"test:integration": "npm run build && NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/**/*.test.ts",
"test:integration": "npm run build && NODE_ENV=test ./node_modules/.bin/mocha --config ./test/integration/mocharc.json ./test/**/*.test.js",
"build": "npm run build:ts && npm run interop:build && npm run build:declarations",
"build:declarations": "tsc --emitDeclarationOnly",
"interop:debug": "dotnet build interop",
Expand Down
4 changes: 4 additions & 0 deletions test/integration/mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"timeout": 5000,
"exit": true
}
35 changes: 35 additions & 0 deletions test/integration/package.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from 'chai'
import path from 'node:path'

import { getInterop, parseDirectories } from '../../build/index.js'

const fixturesFilepath = path.resolve('src/__tests__/fixtures')

const exampleModel = {
'dtmi:com:example:base;1': {
languageMajorVersion: 3,
Id: 'dtmi:com:example:base;1',
ChildOf: 'dtmi:com:example;1',
DefinedIn: 'dtmi:com:example;1',
EntityKind: 'Interface',
ClassId: 'dtmi:dtdl:class:Interface;3',
extendedBy: ['dtmi:com:example;1'],
},
'dtmi:com:example;1': {
languageMajorVersion: 3,
Id: 'dtmi:com:example;1',
EntityKind: 'Interface',
ClassId: 'dtmi:dtdl:class:Interface;3',
extends: ['dtmi:com:example:base;1'],
},
}

describe('integration test on build and package integrity', () => {

Check failure on line 27 in test/integration/package.test.js

View workflow job for this annotation

GitHub Actions / Run Static Analysis Checks (lint)

'describe' is not defined
describe('parser to function as expected', () => {

Check failure on line 28 in test/integration/package.test.js

View workflow job for this annotation

GitHub Actions / Run Static Analysis Checks (lint)

'describe' is not defined
it('parser to function as expected', async () => {

Check failure on line 29 in test/integration/package.test.js

View workflow job for this annotation

GitHub Actions / Run Static Analysis Checks (lint)

'it' is not defined
const parser = await getInterop()
const model = parseDirectories(fixturesFilepath, parser)
expect(model).to.equal(exampleModel)
})
})
})
13 changes: 0 additions & 13 deletions test/integration/package.test.ts

This file was deleted.

0 comments on commit 801e96b

Please sign in to comment.