@snowpack/web-test-runner-plugin
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "@snowpack/web-test-runner-plugin", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "plugin.js", | ||
@@ -11,3 +11,3 @@ "license": "MIT", | ||
"@web/test-runner": "^0.9.0", | ||
"snowpack": "^2.13.0" | ||
"snowpack": "^2.14.3" | ||
}, | ||
@@ -17,3 +17,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "9f6a20c5712ab0d2a971b3969077531fe623fcee" | ||
"gitHead": "d18ab798ad123a1668adee02a3457b86d2208f8e" | ||
} |
@@ -15,7 +15,7 @@ const {isTestFilePath} = require('@web/test-runner'); | ||
const pkgManifest = require(path.join(cwd, 'package.json')); | ||
const config = snowpack.unstable__loadAndValidateConfig( | ||
const config = snowpack.loadAndValidateConfig( | ||
{devOptions: {hmr: false, open: 'none', output: 'stream'}}, | ||
pkgManifest, | ||
); | ||
let loadByUrl, shutdownServer; | ||
let server; | ||
@@ -26,3 +26,3 @@ return { | ||
fileWatcher.add(Object.keys(config.mount)); | ||
const server = await snowpack.unstable__startServer({ | ||
server = await snowpack.startDevServer({ | ||
cwd, | ||
@@ -33,7 +33,5 @@ config, | ||
}); | ||
loadByUrl = server.loadByUrl; | ||
shutdownServer = server.shutdown; | ||
}, | ||
async serverStop() { | ||
return shutdownServer(); | ||
return server.shutdown(); | ||
}, | ||
@@ -45,4 +43,4 @@ async serve({request}) { | ||
const reqPath = request.path; | ||
const result = await loadByUrl(reqPath, {isSSR: false}); | ||
return result; | ||
const result = await server.loadUrl(reqPath, {isSSR: false, encoding: 'utf8'}); | ||
return result.contents; | ||
}, | ||
@@ -53,3 +51,3 @@ transformImport({source}) { | ||
} | ||
// PERF(fks): https://github.com/pikapkg/snowpack/pull/1259/files#r502963818 | ||
// PERF(fks): https://github.com/snowpackjs/snowpack/pull/1259/files#r502963818 | ||
const reqPath = source.substring( | ||
@@ -60,3 +58,3 @@ 0, | ||
const sourcePath = path.join(cwd, reqPath); | ||
const mountedUrl = snowpack.unstable__getUrlForFile(sourcePath, config); | ||
const mountedUrl = snowpack.getUrlForFile(sourcePath, config); | ||
if (!mountedUrl) { | ||
@@ -63,0 +61,0 @@ throw new Error(`${source} could not be mounted!`); |
4362
58