Skip to content

Commit

Permalink
fix(server): allow loading qunit from node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Jan 14, 2025
1 parent 00e4a44 commit 2381311
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions createTestServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export async function createTestServer( {
res.writeHead( 200, { "Content-Type": "text/html" } );
res.end(
indexHTML.replace(
"</head>",
"<script src=\"/node_modules/jquery-test-runner/listeners.js\"></script></head>"
"</body>",
"<script src=\"/node_modules/jquery-test-runner/listeners.js\"></script></body>"
)
);
} else {
Expand Down Expand Up @@ -161,10 +161,12 @@ export async function createTestServer( {
};
use( async( req, res, next ) => {

// Allow serving anything but node_modules, except for jquery-test-runner
// Allow serving anything but node_modules,
// except for jquery-test-runner and qunit
if (
req.url.startsWith( "/node_modules/" ) &&
!req.url.startsWith( "/node_modules/jquery-test-runner/" )
!req.url.startsWith( "/node_modules/jquery-test-runner/" ) &&
!req.url.startsWith( "/node_modules/qunit/" )
) {
return next();
}
Expand Down

0 comments on commit 2381311

Please sign in to comment.