Skip to content

Commit

Permalink
jest test running!
Browse files Browse the repository at this point in the history
  • Loading branch information
trusktr committed Jun 26, 2023
1 parent e0faf4e commit edbc6f7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/core/render/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export class Compiler {
})(text);

const curFileName = this.router.parse().file;
console.log('filename:', curFileName);

if (isCached) {
this.toc = this.cacheTOC[curFileName];
Expand Down
2 changes: 1 addition & 1 deletion test/config/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as server from './server.js';
import server from './server.js';

export default async () => {
await server.startAsync();
Expand Down
2 changes: 1 addition & 1 deletion test/config/jest.teardown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as server from './server.js';
import server from './server.js';

export default async () => {
server.stop();
Expand Down
2 changes: 1 addition & 1 deletion test/config/playwright.setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as server from './server.js';
import server from './server.js';

export default async config => {
await server.startAsync();
Expand Down
2 changes: 1 addition & 1 deletion test/config/playwright.teardown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as server from './server.js';
import server from './server.js';

export default async config => {
server.stop();
Expand Down
12 changes: 6 additions & 6 deletions test/config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ const serverConfig = {
port: hasStartArg ? 3002 : 3001,
};

const TEST_HOST = `http://${serverConfig.hostname}:${serverConfig.port}`;
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export const TEST_HOST = `http://${serverConfig.hostname}:${serverConfig.port}`;

function startServer(options = {}, cb = Function.prototype) {
const defaults = {
...serverConfig,
Expand Down Expand Up @@ -130,9 +131,8 @@ function isMain(meta) {
return false;
}

export {
startServer as start,
startServerAsync as startAsync,
stopServer as stop,
TEST_HOST,
export default {
start: startServer,
startAsync: startServerAsync,
stop: stopServer,
};
5 changes: 3 additions & 2 deletions test/helpers/docsify-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ async function docsifyInit(options = {}) {
const isDocsifyLoaded = 'Docsify' in window;

if (!isDocsifyLoaded) {
require(docsifyPATH);
// require(docsifyPATH);
await import(docsifyPATH);
}
} else if (isPlaywright) {
for (const url of settings.scriptURLs) {
Expand Down Expand Up @@ -359,4 +360,4 @@ async function docsifyInit(options = {}) {
return Promise.resolve();
}

module.exports = docsifyInit;
export default docsifyInit;

0 comments on commit edbc6f7

Please sign in to comment.