Skip to content

Commit 8cdfb8f

Browse files
committed
feature: @putout/plugin-nodejs: declare: process: env
1 parent 56feadc commit 8cdfb8f

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

packages/plugin-nodejs/lib/declare/fixture/node-js-fs-fix.js renamed to packages/plugin-nodejs/lib/declare/fixture/fs-fix.js

File renamed without changes.
File renamed without changes.

packages/plugin-nodejs/lib/declare/fixture/node-js-zlib-fix.js renamed to packages/plugin-nodejs/lib/declare/fixture/zlib-fix.js

File renamed without changes.

packages/plugin-nodejs/lib/declare/fixture/node-js-zlib.js renamed to packages/plugin-nodejs/lib/declare/fixture/zlib.js

File renamed without changes.

packages/plugin-nodejs/lib/declare/index.spec.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ test('putout: plugin: nodejs: declare: no report after transform: join', (t) =>
3838
t.end();
3939
});
4040

41-
test('putout: plugin: nodejs: declare: node-js-fs', (t) => {
42-
t.transform('node-js-fs');
41+
test('putout: plugin: nodejs: declare: fs', (t) => {
42+
t.transform('fs');
4343
t.end();
4444
});
4545

46-
test('putout: plugin: nodejs: declare: node-js-zlib', (t) => {
47-
t.transform('node-js-zlib');
46+
test('putout: plugin: nodejs: declare: zlib', (t) => {
47+
t.transform('zlib');
4848
t.end();
4949
});
5050

@@ -88,7 +88,7 @@ test('putout: plugin: nodejs: declare: nodejs: util', (t) => {
8888
t.end();
8989
});
9090

91-
test('putout: plugin: nodejs: declare: node-js: process', (t) => {
91+
test('putout: plugin: nodejs: declare: process: cwd', (t) => {
9292
t.transformCode(`cwd();`, montag`
9393
import {cwd} from 'process';
9494
@@ -98,22 +98,27 @@ test('putout: plugin: nodejs: declare: node-js: process', (t) => {
9898
t.end();
9999
});
100100

101-
test('putout: plugin: nodejs: declare: no transform: promises', (t) => {
102-
t.noTransformCode(`promises.filter();\n`);
101+
test('putout: plugin: nodejs: declare: process: env', (t) => {
102+
t.transformCode(`const a = env.DEBUG;`, montag`
103+
import {env} from 'process';
104+
105+
const a = env.DEBUG;
106+
107+
`);
103108
t.end();
104109
});
105110

106-
test('putout: plugin: nodejs: declare: node-js: no transform: version', (t) => {
107-
t.noTransformCode(`version;\n`);
111+
test('putout: plugin: nodejs: declare: no transform: promises', (t) => {
112+
t.noTransformCode(`promises.filter();\n`);
108113
t.end();
109114
});
110115

111-
test('putout: plugin: nodejs: declare: node-js: no transform: env', (t) => {
112-
t.noTransformCode(`env;\n`);
116+
test('putout: plugin: nodejs: declare: no transform: version', (t) => {
117+
t.noTransformCode(`version;\n`);
113118
t.end();
114119
});
115120

116-
test('putout: plugin: nodejs: declare: node-js: events', (t) => {
121+
test('putout: plugin: nodejs: declare: events', (t) => {
117122
t.transformCode(`new EventEmitter();`, montag`
118123
import {EventEmitter} from 'events';
119124

packages/plugin-nodejs/lib/declare/modules/process.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default {
3535
umask: `import {umask} from 'process'`,
3636
chdir: `import {chdir} from 'process'`,
3737
cwd: `import {cwd} from 'process'`,
38+
env: `import {env} from 'process'`,
3839
initgroups: `import {initgroups} from 'process'`,
3940
setgroups: `import {setgroups} from 'process'`,
4041
setegid: `import {setegid} from 'process'`,

0 commit comments

Comments
 (0)