Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stylable/e2e-test-kit

Package Overview
Dependencies
Maintainers
5
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/e2e-test-kit - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

cjs/isolated-server.d.ts

13

cjs/project-runner.d.ts

@@ -1,3 +0,1 @@

/// <reference types="node" />
import http from 'http';
import puppeteer from 'puppeteer';

@@ -9,2 +7,3 @@ import webpack from 'webpack';

puppeteerOptions: puppeteer.LaunchOptions;
webpackOptions?: webpack.Configuration;
throwOnBuildError?: boolean;

@@ -25,8 +24,10 @@ configName?: string;

serverUrl: string;
server: http.Server | null;
server: {
close(): void;
} | null;
browser: puppeteer.Browser | null;
constructor({ projectDir, port, puppeteerOptions, throwOnBuildError, configName }: Options);
loadTestConfig(configName?: string): any;
constructor({ projectDir, port, puppeteerOptions, throwOnBuildError, webpackOptions, configName }: Options);
loadTestConfig(configName?: string, webpackOptions?: webpack.Configuration): any;
bundle(): Promise<void>;
serve(): Promise<void>;
serve(): Promise<unknown>;
openInBrowser(): Promise<{

@@ -33,0 +34,0 @@ page: puppeteer.Page;

@@ -6,4 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const create_listening_server_1 = require("create-listening-server");
const express_1 = __importDefault(require("express"));
const child_process_1 = require("child_process");
const path_1 = require("path");

@@ -16,6 +15,6 @@ const puppeteer_1 = __importDefault(require("puppeteer"));

class ProjectRunner {
constructor({ projectDir, port = 3000, puppeteerOptions = {}, throwOnBuildError = true, configName = 'webpack.config' }) {
constructor({ projectDir, port = 3000, puppeteerOptions = {}, throwOnBuildError = true, webpackOptions, configName = 'webpack.config' }) {
this.projectDir = projectDir;
this.outputDir = path_1.join(this.projectDir, 'dist');
this.webpackConfig = this.loadTestConfig(configName);
this.webpackConfig = this.loadTestConfig(configName, webpackOptions);
this.port = port;

@@ -43,4 +42,7 @@ this.serverUrl = `http://localhost:${this.port}`;

}
loadTestConfig(configName) {
return require(path_1.join(this.projectDir, configName || 'webpack.config'));
loadTestConfig(configName, webpackOptions = {}) {
return {
...require(path_1.join(this.projectDir, configName || 'webpack.config')),
...webpackOptions
};
}

@@ -67,8 +69,23 @@ async bundle() {

async serve() {
const app = express_1.default();
app.use(express_1.default.static(this.outputDir, { cacheControl: false, etag: false }));
const { httpServer, port } = await create_listening_server_1.safeListeningHttpServer(this.port, app);
this.port = port;
this.serverUrl = `http://localhost:${port}`;
this.server = httpServer;
return new Promise(res => {
const child = child_process_1.spawn('node', [
'-r',
'@ts-tools/node/r',
'./isolated-server',
this.outputDir,
this.port.toString()
], {
cwd: __dirname,
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
});
child.once('message', port => {
this.serverUrl = `http://localhost:${port}`;
this.server = {
async close() {
child.kill();
}
};
res();
});
});
}

@@ -75,0 +92,0 @@ async openInBrowser() {

@@ -0,5 +1,6 @@

import webpack from 'webpack';
import { ProjectRunner } from './project-runner';
export declare class StylableProjectRunner extends ProjectRunner {
loadTestConfig(configName?: string): any;
loadTestConfig(configName?: string, webpackOptions?: webpack.Configuration): any;
}
//# sourceMappingURL=stylable-project-runner.d.ts.map

@@ -5,4 +5,4 @@ "use strict";

class StylableProjectRunner extends project_runner_1.ProjectRunner {
loadTestConfig(configName) {
const config = super.loadTestConfig(configName);
loadTestConfig(configName, webpackOptions = {}) {
const config = super.loadTestConfig(configName, webpackOptions);
if (config.plugins) {

@@ -9,0 +9,0 @@ const plugin = config.plugins.find((p) => p.constructor.name === 'StylableWebpackPlugin');

{
"name": "@stylable/e2e-test-kit",
"version": "3.0.0",
"version": "3.1.0",
"description": "A collection of tools to help test Stylable components and applications from end-to-end",

@@ -13,3 +13,3 @@ "main": "cjs/index.js",

"dependencies": {
"@stylable/runtime": "^3.0.0",
"@stylable/runtime": "^3.1.0",
"express": "^4.17.1",

@@ -20,3 +20,3 @@ "memory-fs": "^0.5.0",

"rimraf": "^3.0.0",
"webpack": "^4.41.2"
"webpack": "^4.41.5"
},

@@ -36,3 +36,3 @@ "files": [

"license": "BSD-3-Clause",
"gitHead": "91b92e8380ec81e5ad6ae4d96625f8d9e972c50d"
"gitHead": "8a4adb3f4741359c5c9ae4f0b9a1195a78251338"
}

@@ -1,4 +0,2 @@

import { safeListeningHttpServer } from 'create-listening-server';
import express from 'express';
import http from 'http';
import { spawn } from 'child_process';
import { join, normalize } from 'path';

@@ -14,2 +12,3 @@ import puppeteer from 'puppeteer';

puppeteerOptions: puppeteer.LaunchOptions;
webpackOptions?: webpack.Configuration;
throwOnBuildError?: boolean;

@@ -56,3 +55,3 @@ configName?: string;

public serverUrl: string;
public server!: http.Server | null;
public server!: { close(): void } | null;
public browser!: puppeteer.Browser | null;

@@ -64,2 +63,3 @@ constructor({

throwOnBuildError = true,
webpackOptions,
configName = 'webpack.config'

@@ -69,3 +69,3 @@ }: Options) {

this.outputDir = join(this.projectDir, 'dist');
this.webpackConfig = this.loadTestConfig(configName);
this.webpackConfig = this.loadTestConfig(configName, webpackOptions);
this.port = port;

@@ -78,4 +78,7 @@ this.serverUrl = `http://localhost:${this.port}`;

}
public loadTestConfig(configName?: string) {
return require(join(this.projectDir, configName || 'webpack.config'));
public loadTestConfig(configName?: string, webpackOptions: webpack.Configuration = {}) {
return {
...require(join(this.projectDir, configName || 'webpack.config')),
...webpackOptions
};
}

@@ -102,8 +105,27 @@ public async bundle() {

public async serve() {
const app = express();
app.use(express.static(this.outputDir, { cacheControl: false, etag: false }));
const { httpServer, port } = await safeListeningHttpServer(this.port, app);
this.port = port;
this.serverUrl = `http://localhost:${port}`;
this.server = httpServer;
return new Promise(res => {
const child = spawn(
'node',
[
'-r',
'@ts-tools/node/r',
'./isolated-server',
this.outputDir,
this.port.toString()
],
{
cwd: __dirname,
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
}
);
child.once('message', port => {
this.serverUrl = `http://localhost:${port}`;
this.server = {
async close() {
child.kill();
}
};
res();
});
});
}

@@ -110,0 +132,0 @@

@@ -0,6 +1,7 @@

import webpack from 'webpack';
import { ProjectRunner } from './project-runner';
export class StylableProjectRunner extends ProjectRunner {
public loadTestConfig(configName?: string) {
const config = super.loadTestConfig(configName);
public loadTestConfig(configName?: string, webpackOptions: webpack.Configuration = {}) {
const config = super.loadTestConfig(configName, webpackOptions);
if (config.plugins) {

@@ -7,0 +8,0 @@ const plugin = config.plugins.find(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc