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

fancy-test

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-test - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

8

CHANGELOG.md

@@ -0,1 +1,9 @@

<a name="0.6.4"></a>
## [0.6.4](https://github.com/jdxcode/fancy-test/compare/33db7edbb2cf97b178c4490bbff6740abcd28840...v0.6.4) (2018-01-28)
### Bug Fixes
* close over envs ([16de1b4](https://github.com/jdxcode/fancy-test/commit/16de1b4))
<a name="0.6.3"></a>

@@ -2,0 +10,0 @@ ## [0.6.3](https://github.com/jdxcode/fancy-test/compare/460043efd4a967ac07a5efadcc421211627c9e6c...v0.6.3) (2018-01-28)

7

lib/env.d.ts

@@ -1,5 +0,8 @@

import { Env, EnvOptions } from './types';
import { EnvOptions } from './types';
declare const _default: (env: {
[k: string]: string | null | undefined;
}, opts?: EnvOptions) => Env;
}, opts?: EnvOptions) => {
run(): void;
finally(): void;
};
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("lodash");
exports.default = (env, opts = {}) => ({
run(ctx) {
// normalize to undefined
const normalizedEnv = _.mapValues(env, v => v === null ? undefined : v);
// store previous env for finally
ctx.envs = ctx.envs || [];
ctx.envs.push(process.env);
if (opts.clear) {
process.env = Object.assign({}, normalizedEnv);
}
else {
process.env = Object.assign({}, process.env, normalizedEnv);
Object.entries(normalizedEnv)
.filter(([, v]) => v === undefined)
.forEach(([k]) => { delete process.env[k]; });
}
},
finally(ctx) {
const env = ctx.envs.pop();
if (env)
process.env = env;
},
});
exports.default = (env, opts = {}) => {
const envs = [];
return {
run() {
// normalize to undefined
const normalizedEnv = _.mapValues(env, v => v === null ? undefined : v);
// store previous env for finally
envs.push(process.env);
if (opts.clear) {
process.env = Object.assign({}, normalizedEnv);
}
else {
process.env = Object.assign({}, process.env, normalizedEnv);
Object.entries(normalizedEnv)
.filter(([, v]) => v === undefined)
.forEach(([k]) => { delete process.env[k]; });
}
},
finally() {
const env = envs.pop();
if (env)
process.env = env;
},
};
};

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

/// <reference types="node" />
/// <reference types="nock" />

@@ -44,5 +43,3 @@ import { expect } from './chai';

env: {
output: {
envs: NodeJS.ProcessEnv[];
};
output: {};
a1: {

@@ -49,0 +46,0 @@ [k: string]: string | null | undefined;

@@ -60,6 +60,2 @@ /// <reference types="mocha" />

}
export interface Env extends Plugin<{
envs: (typeof process.env)[];
}> {
}
export declare type MochaDone = (error?: any) => any;
{
"name": "fancy-test",
"description": "extendable utilities for testing",
"version": "0.6.3",
"version": "0.6.4",
"author": "Jeff Dickey @jdxcode",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/jdxcode/fancy-test/issues",

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