Skip to content

Commit

Permalink
Fix tests and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Oct 27, 2023
1 parent d48c926 commit d092cdd
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 66 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
],
"scripts": {
"generate": "npm --workspace vscode-mdx run generate",
"build": "npm --workspaces run build",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "npm run test-api --workspaces --if-present",
"test": "npm run build && npm run format && npm run test-api"
"test-types": "tsc --build --clean packages && tsc --build packages",
"test-api": "node --test",
"test": "npm run test-types && npm run format && npm run test-api"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"unified"
],
"scripts": {
"build": "tsc",
"test-api": "node --test"
"test-api": "node --test",
"test": "npm run test-api"
},
"dependencies": {
"@mdx-js/language-service": "0.1.0",
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 4 additions & 9 deletions packages/language-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"include": ["**/**.js"],
"extends": "..",
"include": ["**/*.js", "package.json"],
"exclude": ["coverage/", "node_modules/"],
"references": [{"path": "../language-service"}],
"compilerOptions": {
"checkJs": true,
"module": "node16",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"paths": {
"@mdx-js/language-service": ["../language-service/index.js"]
}
"resolveJsonModule": true
}
}
6 changes: 3 additions & 3 deletions packages/language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"unified"
],
"scripts": {
"build": "tsc --build --clean && tsc --build",
"prepack": "npm run build",
"test": "node --test"
"prepack": "tsc --build --clean && tsc --build",
"test-api": "node --test",
"test": "npm pack && npm run test-api"
},
"dependencies": {
"@types/mdast": "^4.0.0",
Expand Down
49 changes: 18 additions & 31 deletions packages/language-service/test/language-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ test('create virtual file w/ mdxjsEsm', () => {
embeddedFiles: [],
fileName: 'file:///test.mdx.md',
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 35],
generatedRange: [0, 35],
data: FileRangeCapabilities.full
}
],
mappings: [],
snapshot: snapshotFromLines(' ', '')
}
]
Expand Down Expand Up @@ -148,13 +142,7 @@ test('create virtual file w/ mdxFlowExpression', () => {
embeddedFiles: [],
fileName: 'file:///test.mdx.md',
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 10],
generatedRange: [0, 10],
data: FileRangeCapabilities.full
}
],
mappings: [],
snapshot: snapshotFromLines(' ', '')
}
]
Expand Down Expand Up @@ -244,8 +232,8 @@ test('create virtual file w/ mdxJsxFlowElement w/ children', () => {
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 66],
generatedRange: [0, 66],
sourceRange: [9, 59],
generatedRange: [9, 59],
data: FileRangeCapabilities.full
}
],
Expand Down Expand Up @@ -323,13 +311,7 @@ test('create virtual file w/ mdxJsxFlowElement w/o children', () => {
embeddedFiles: [],
fileName: 'file:///test.mdx.md',
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 8],
generatedRange: [0, 8],
data: FileRangeCapabilities.full
}
],
mappings: [],
snapshot: snapshotFromLines(' ', '')
}
]
Expand Down Expand Up @@ -399,8 +381,8 @@ test('create virtual file w/ mdxJsxTextElement', () => {
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 10],
generatedRange: [0, 10],
sourceRange: [0, 2],
generatedRange: [0, 2],
data: FileRangeCapabilities.full
}
],
Expand Down Expand Up @@ -473,8 +455,13 @@ test('create virtual file w/ mdxTextExpression', () => {
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 18],
generatedRange: [0, 18],
sourceRange: [0, 4],
generatedRange: [0, 4],
data: FileRangeCapabilities.full
},
{
sourceRange: [14, 17],
generatedRange: [14, 17],
data: FileRangeCapabilities.full
}
],
Expand Down Expand Up @@ -605,8 +592,8 @@ test('create virtual file w/ yaml frontmatter', () => {
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 27],
generatedRange: [0, 27],
sourceRange: [0, 26],
generatedRange: [0, 26],
data: FileRangeCapabilities.full
}
],
Expand Down Expand Up @@ -693,8 +680,8 @@ test('update virtual file', () => {
kind: FileKind.TypeScriptHostFile,
mappings: [
{
sourceRange: [0, 19],
generatedRange: [0, 19],
sourceRange: [0, 18],
generatedRange: [0, 18],
data: FileRangeCapabilities.full
}
],
Expand Down
10 changes: 3 additions & 7 deletions packages/language-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"include": ["**/**.js"],
"extends": "..",
"include": ["**/*.js"],
"exclude": ["coverage/", "node_modules/"],
"compilerOptions": {
"checkJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"module": "node16",
"skipLibCheck": true,
"strict": true,
"target": "es2020"
"emitDeclarationOnly": true
}
}
16 changes: 16 additions & 0 deletions packages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files": [],
"references": [
{"path": "./language-server"},
{"path": "./language-service"},
{"path": "./vscode-mdx"}
],
"compilerOptions": {
"checkJs": true,
"composite": true,
"lib": ["es2021"],
"module": "node16",
"strict": true,
"target": "es2021"
}
}
15 changes: 4 additions & 11 deletions packages/vscode-mdx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
{
"include": ["**/**.js"],
"exclude": ["coverage/", "node_modules/"],
"extends": "..",
"include": ["**/*.js"],
"exclude": ["coverage/", "node_modules/", "out/"],
"compilerOptions": {
"checkJs": true,
"esModuleInterop": false,
"module": "node16",
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"paths": {
"@mdx-js/language-service": ["../language-service/index.js"]
}
"noEmit": true
}
}

0 comments on commit d092cdd

Please sign in to comment.