Skip to content

Commit

Permalink
Update test script and enable sourceMap in tsconfig
Browse files Browse the repository at this point in the history
The test script in `src/__tests__/test.ts` has been updated for better functionality and improved plugin initialization. The `sourceMap` property in the `tsconfig.json` file has been set to `true` to generate corresponding '.map' files. The `Runtime` in `
  • Loading branch information
qianlifeng committed Jun 5, 2024
1 parent 031226e commit b78a8b5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Author": "[Author Name]",
"Version": "0.0.1",
"MinWoxVersion": "2.0.0",
"Runtime": "[Runtime]",
"Runtime": "nodejs",
"Website": "[Website]",
"Entry": "index.js",
"Icon": "relative:images/app.png",
Expand Down
29 changes: 27 additions & 2 deletions src/__tests__/test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
test("4 greater than 1", async () => {
expect(4).toBeGreaterThan(1);
import { Context, PublicAPI, Query } from "@wox-launcher/wox-plugin"
import { plugin } from "../index"

test("query", async () => {
const ctx = {} as Context
const query = {
Env: { "ActiveWindowTitle": "" },
RawQuery: "wpm install ",
Selection: { Type: "text", Text: "", FilePaths: [] },
Type: "input",
Search: "",
TriggerKeyword: "wpm",
Command: "install",
IsGlobalQuery(): boolean {
return false
}
} as Query

await plugin.init(ctx, {
PluginDirectory: "", API: {
Log: (ctx, level, message) => {
console.log(level, message)
}
} as PublicAPI
})
const results = await plugin.query(ctx, query)
expect(results.length).toBeGreaterThan(0)
})
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"declaration": false,
/* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": false,
"sourceMap": true,
/* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "dist",
Expand Down Expand Up @@ -90,4 +90,4 @@
"node_modules",
"types"
]
}
}

0 comments on commit b78a8b5

Please sign in to comment.