Socket
Socket
Sign inDemoInstall

@web/test-runner-commands

Package Overview
Dependencies
191
Maintainers
7
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 0.5.1

dist/snapshotPlugin.d.ts

61

browser/commands.d.ts

@@ -1,6 +0,12 @@

import { Media } from '../dist/index';
import { Viewport } from '../dist/index';
import { SendKeysPayload } from '../dist/index';
import { A11ySnapshotPayload } from '../dist/index';
import { WriteFilePayload, ReadFilePayload, RemoveFilePayload } from '../dist/index';
import {
Media,
Viewport,
SendKeysPayload,
A11ySnapshotPayload,
WriteFilePayload,
ReadFilePayload,
RemoveFilePayload,
SnapshotPluginConfig,
SaveSnapshotPayload,
} from '../dist/index';

@@ -131,3 +137,3 @@ /**

* ```ts
* await writeFile('hello-world.txt', "Hello world!");
* await writeFile({ path: 'hello-world.txt', content: 'Hello world!' });
* ```

@@ -146,6 +152,6 @@ */

* ```ts
* const content = await readFile('hello-world.txt');
* const content = await readFile({ path: 'hello-world.txt' });
* ```
*/
export function readFile(payload: WriteFilePayload): Promise<string>;
export function readFile(payload: WriteFilePayload): Promise<string | undefined>;

@@ -160,7 +166,42 @@ /**

* ```ts
* await removeFile('hello-world.txt');
* await removeFile({ path: 'hello-world.txt' });
* ```
*/
export function removeFile(payload: RemoveFilePayload): Promise<string>;
export function removeFile(payload: RemoveFilePayload): Promise<void>;
/**
* Gets configuration for snapshot testing.
*
* @param payload.updateSnapshots whether to updated snapshots that are not the same
*/
export function getSnapshotConfig(): Promise<SnapshotPluginConfig>;
/**
* Gets the snapshots stored for this test file.
*/
export function getSnapshots(): Promise<Record<string, string>>;
/**
* Saves a snapshot for this test file.
*
* @param payload.name the name of the snapshot
*/
export function getSnapshot(options: { name: string }): Promise<string | undefined>;
/**
* Saves a snapshot for this test file.
*
* @param payload.name the name of the snapshot
* @param payload.content the content of the snapshot as a string
*/
export function saveSnapshot(options: SaveSnapshotPayload): Promise<void>;
/**
* Removes stored snapshots for this test file.
*
* @param payload.name the name of the snapshot
*
*/
export function removeSnapshot(options: { name: string }): Promise<void>;
export { Media, Viewport, SendKeysPayload, WriteFilePayload, ReadFilePayload, RemoveFilePayload };
# @web/test-runner-commands
## 0.5.1
### Patch Changes
- 339d05f7: add snapshots plugin
## 0.5.0

@@ -4,0 +10,0 @@

8

dist/filePlugin.js

@@ -76,6 +76,8 @@ "use strict";

const filePath = joinFilePath(session.testFile, payload.path);
if (!(await fileExists(filePath))) {
throw new Error(`Could not read file at ${filePath} because it does not exist.`);
if (await fileExists(filePath)) {
return readFile(filePath, payload.encoding || 'utf-8');
}
return readFile(filePath, payload.encoding || 'utf-8');
else {
return undefined;
}
}

@@ -82,0 +84,0 @@ if (command === 'remove-file') {

@@ -7,2 +7,3 @@ export { Viewport, setViewportPlugin } from './setViewportPlugin';

export { WriteFilePayload, ReadFilePayload, RemoveFilePayload, filePlugin } from './filePlugin';
export { SaveSnapshotPayload, SnapshotPluginConfig, snapshotPlugin } from './snapshotPlugin';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filePlugin = exports.a11ySnapshotPlugin = exports.sendKeysPlugin = exports.setUserAgentPlugin = exports.emulateMediaPlugin = exports.setViewportPlugin = void 0;
exports.snapshotPlugin = exports.filePlugin = exports.a11ySnapshotPlugin = exports.sendKeysPlugin = exports.setUserAgentPlugin = exports.emulateMediaPlugin = exports.setViewportPlugin = void 0;
var setViewportPlugin_1 = require("./setViewportPlugin");

@@ -16,2 +16,4 @@ Object.defineProperty(exports, "setViewportPlugin", { enumerable: true, get: function () { return setViewportPlugin_1.setViewportPlugin; } });

Object.defineProperty(exports, "filePlugin", { enumerable: true, get: function () { return filePlugin_1.filePlugin; } });
var snapshotPlugin_1 = require("./snapshotPlugin");
Object.defineProperty(exports, "snapshotPlugin", { enumerable: true, get: function () { return snapshotPlugin_1.snapshotPlugin; } });
//# sourceMappingURL=index.js.map
{
"name": "@web/test-runner-commands",
"version": "0.5.0",
"version": "0.5.1",
"publishConfig": {

@@ -30,3 +30,3 @@ "access": "public"

"test": "mocha test/**/*.test.ts --require ts-node/register",
"test:watch": "mocha test/**/*.test.ts --require ts-node/register --watch --watch-files src,test"
"test:watch": "mocha test/**/*.test.ts --require ts-node/register --watch --watch-files src,test --watch-ignore **/*.snap.js"
},

@@ -33,0 +33,0 @@ "files": [

@@ -90,6 +90,7 @@ import { TestRunnerPlugin } from '@web/test-runner-core';

const filePath = joinFilePath(session.testFile, payload.path);
if (!(await fileExists(filePath))) {
throw new Error(`Could not read file at ${filePath} because it does not exist.`);
if (await fileExists(filePath)) {
return readFile(filePath, payload.encoding || 'utf-8');
} else {
return undefined;
}
return readFile(filePath, payload.encoding || 'utf-8');
}

@@ -96,0 +97,0 @@

@@ -7,1 +7,2 @@ export { Viewport, setViewportPlugin } from './setViewportPlugin';

export { WriteFilePayload, ReadFilePayload, RemoveFilePayload, filePlugin } from './filePlugin';
export { SaveSnapshotPayload, SnapshotPluginConfig, snapshotPlugin } from './snapshotPlugin';

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc