Skip to content

Commit

Permalink
fix(test): browser tests with ts
Browse files Browse the repository at this point in the history
  • Loading branch information
LuLaValva committed Dec 14, 2023
1 parent 12a3635 commit 91b78ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions marko-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = ({ config }) => {
"lasso-less",
],
require: {
extensions: [".js", ".ts"],
transforms: [
{
transform:
Expand Down
6 changes: 5 additions & 1 deletion src/common/menu-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ export interface MenuState {
checkedItems?: boolean[];
}

const Component = (typeof Marko === "object"
? Marko.Component
: function () {}) as any as typeof Marko.Component;

export class MenuUtils<
Input extends BaseMenuInput,
State extends MenuState,
> extends Marko.Component<Input, State> {
> extends Component<Input, State> {
declare type?: string;
declare items: Extract<Input["items"], any[]>[number][];

Expand Down
3 changes: 2 additions & 1 deletion src/common/test-utils/lasso-require-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function (lasso) {
this.path = this.resolvePath(this.path);
},
async read() {
console.log("load", this.path);
return await fs.promises.readFile(this.path, "utf-8");
},
getSourceFile: function () {
Expand All @@ -22,7 +23,7 @@ module.exports = function (lasso) {
lasso.dependencies.registerRequireExtension("md", {
read: async function (path) {
return `module.exports = ${JSON.stringify(
await fs.promises.readFile(path, "utf-8")
await fs.promises.readFile(path, "utf-8"),
)}`;
},

Expand Down

0 comments on commit 91b78ee

Please sign in to comment.