yeoman-test 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,7 +1,13 @@
1
1
  /* eslint-disable max-params */
2
2
 
3
3
  'use strict';
4
- const fs = require('fs');
4
+ const {
5
+ writeFile,
6
+ mkdirSync,
7
+ existsSync,
8
+ rmdirSync,
9
+ rmSync = rmdirSync
10
+ } = require('fs');
5
11
  const _ = require('lodash');
6
12
  const path = require('path');
7
13
  const sinon = require('sinon');
@@ -59,7 +65,7 @@ YeomanTest.prototype.gruntfile = function (options, done) {
59
65
 
60
66
  const out = ['module.exports = function (grunt) {', config, '};'];
61
67
 
62
- fs.writeFile('Gruntfile.js', out.join('\n'), done);
68
+ writeFile('Gruntfile.js', out.join('\n'), done);
63
69
  };
64
70
 
65
71
  /**
@@ -85,11 +91,11 @@ YeomanTest.prototype.testDirectory = function (dir, cb) {
85
91
  process.chdir('/');
86
92
 
87
93
  try {
88
- if (fs.existsSync(dir)) {
89
- fs.rmdirSync(dir, {recursive: true});
94
+ if (existsSync(dir)) {
95
+ rmSync(dir, {recursive: true});
90
96
  }
91
97
 
92
- fs.mkdirSync(dir, {recursive: true});
98
+ mkdirSync(dir, {recursive: true});
93
99
  process.chdir(dir);
94
100
  cb();
95
101
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  const crypto = require('crypto');
3
- const fs = require('fs');
3
+ const {existsSync, rmdirSync, rmSync = rmdirSync} = require('fs');
4
4
  const path = require('path');
5
5
  const assert = require('assert');
6
6
  const _ = require('lodash/string');
@@ -422,8 +422,8 @@ RunContext.prototype.cleanTestDirectory = function (force = false) {
422
422
  throw new Error('Cleanup test dir called with false tmpdir option.');
423
423
  }
424
424
 
425
- if (this.targetDirectory && fs.existsSync(this.targetDirectory)) {
426
- fs.rmdirSync(this.targetDirectory, {recursive: true});
425
+ if (this.targetDirectory && existsSync(this.targetDirectory)) {
426
+ rmSync(this.targetDirectory, {recursive: true});
427
427
  }
428
428
  };
429
429
 
package/lib/run-result.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  const assert = require('assert');
3
- const fs = require('fs');
3
+ const {existsSync, readFileSync, rmdirSync, rmSync = rmdirSync} = require('fs');
4
4
  const MemFsEditor = require('mem-fs-editor');
5
5
  const path = require('path');
6
6
 
@@ -124,7 +124,7 @@ class RunResult {
124
124
  */
125
125
  cleanup() {
126
126
  process.chdir(this.oldCwd);
127
- fs.rmdirSync(this.cwd, {recursive: true});
127
+ rmSync(this.cwd, {recursive: true});
128
128
  return this;
129
129
  }
130
130
 
@@ -142,7 +142,7 @@ class RunResult {
142
142
  if (this.fs) {
143
143
  file = this.fs.read(filename, 'utf8');
144
144
  } else {
145
- file = fs.readFileSync(filename, 'utf8');
145
+ file = readFileSync(filename, 'utf8');
146
146
  }
147
147
 
148
148
  return json ? JSON.parse(file) : file;
@@ -154,7 +154,7 @@ class RunResult {
154
154
  return this.fs.exists(filename);
155
155
  }
156
156
 
157
- return fs.existsSync(filename);
157
+ return existsSync(filename);
158
158
  }
159
159
 
160
160
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-test",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "Test utilities for Yeoman generators",
5
5
  "homepage": "http://yeoman.io/authoring/testing.html",
6
6
  "author": "The Yeoman Team",
@@ -23,10 +23,10 @@
23
23
  "devDependencies": {
24
24
  "coveralls": "^3.1.0",
25
25
  "husky": "^4.2.5",
26
- "jsdoc": "^3.6.6",
26
+ "jsdoc": "^3.6.10",
27
27
  "lint-staged": "^10.2.11",
28
28
  "mem-fs": "^2.1.0",
29
- "mocha": "^8.0.1",
29
+ "mocha": "^9.2.0",
30
30
  "nyc": "^15.1.0",
31
31
  "prettier": "^2.2.1",
32
32
  "tui-jsdoc-template": "^1.2.2",