Skip to content

Commit

Permalink
Merge pull request #299 from zazuko/test-fixes
Browse files Browse the repository at this point in the history
Test fixes
  • Loading branch information
tpluscode authored May 15, 2024
2 parents 30be08d + d1dfc9a commit 2c9e4e4
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-walls-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"barnard59-formats": patch
---

Context was unbound in step `jsonld/parse/object`
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
with:
node-version: ${{ matrix.node }}
- run: npm ci
- name: Compile TypeScript packages
run: npx wsrun -mc build --sourceMap
- run: npx c8 --all --src packages/${{ matrix.package }} -x "packages/!(${{ matrix.package }})" --reporter lcovonly --reporter text wsrun --no-prefix -p barnard59-${{ matrix.package }} -c test
- name: Codecov
uses: codecov/codecov-action@v3
Expand Down
60 changes: 47 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@tpluscode/eslint-config": "^0.4.5",
"@types/chai": "^4.3.16",
"@types/node": "^18",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
Expand All @@ -27,7 +28,6 @@
"mocha": "^10.2.0",
"sinon-chai": "^3.7.0",
"ts-node": "^10.9.2",
"tsm": "^2.3.0",
"typescript": "^5.3.2",
"wsrun": "^5.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
},
"mocha": {
"require": "../../test/mocha-setup.cjs",
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@rdfjs-elements/formats-pretty": "^0.6.7",
"@types/lodash": "^4.14.202",
"@types/readable-stream": "^4.0.10",
"@types/shelljs": "^0.8.15",
"approvals": "^6.2.2",
"barnard59-base": "^2.4.2",
"barnard59-formats": "^2.1.1",
Expand All @@ -66,6 +67,6 @@
"strip-ansi": "^7.0.0"
},
"mocha": {
"loader": "esmock"
"loader": "ts-node/esm/transpile-only"
}
}
4 changes: 4 additions & 0 deletions packages/cli/test/support/filenamePipelineDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { resolve } from 'path'

const base = new URL('.', import.meta.url).pathname

/**
* @param {string} name
* @returns {string}
*/
function filenamePipelineDefinition(name) {
return resolve(base, `definitions/${name}.ttl`)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
},
"mocha": {
"require": "../../test/mocha-setup.cjs",
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/csvw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"node": ">= 14.0.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/cube/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"shelljs": "^0.8.5"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/formats/jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function parse({ localContext } = {}) {
})
}

const parseObject = () => {
const parseObject = function () {
return tracer.startActiveSpan('jsonld:parse.object', span => {
const stream = combine([jsonStringify(), parse.call(this)], { objectMode: true })
stream.on('error', err => {
Expand Down
2 changes: 1 addition & 1 deletion packages/formats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"node": ">= 14.0.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/ftp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
"ssh2": "^1.15.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/graph-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"node": ">= 14.0.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
2 changes: 1 addition & 1 deletion packages/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"is-stream": "^3.0.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm"
}
}
2 changes: 1 addition & 1 deletion packages/rdf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
},
"mocha": {
"require": "../../test/mocha-setup.cjs",
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
2 changes: 1 addition & 1 deletion packages/s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"rimraf": "^5.0.5"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
2 changes: 1 addition & 1 deletion packages/shacl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
},
"mocha": {
"require": "../../test/mocha-setup.cjs",
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
2 changes: 1 addition & 1 deletion packages/sparql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"node": ">= 14.0.0"
},
"mocha": {
"loader": "tsm"
"loader": "ts-node/esm/transpile-only"
}
}
2 changes: 2 additions & 0 deletions packages/validation/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { manifestLocation } from './config.js'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const require = module.createRequire(url.fileURLToPath(import.meta.url))

require.extensions['.ts'] = require.extensions['.js']

const resolvePaths = [
process.cwd(),
__dirname,
Expand Down
2 changes: 1 addition & 1 deletion packages/validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"rdf-loader-code": "^2.1.3"
},
"mocha": {
"loader": "esmock"
"loader": ["ts-node/esm", "esmock"]
}
}
8 changes: 7 additions & 1 deletion packages/validation/test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ const { assert } = chai
chai.use(chaiExec)
chaiExec.defaults = {
command: './cli.js',
options: {
env: {
...process.env,
NODE_OPTIONS: '--no-warnings --loader ts-node/esm',
},
},
}

describe('barnard59-validate', function () {
this.timeout(10000)
this.timeout(20000)

it('should exit with a zero exit code', () => {
const cli = chaiExec(' ./sample-pipelines/fetch-json-to-ntriples.ttl')
Expand Down

0 comments on commit 2c9e4e4

Please sign in to comment.