Skip to content

Commit 74b7f73

Browse files
fixup! fixup! fixup! fixup! fixup! feat: add fs/stat
fix: update error handling in statSync stub to throw TypeError for unsupported options --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent d469d00 commit 74b7f73

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lib/node_modules/@stdlib/fs/stat/test/test.sync.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,16 @@ tape( 'the function passes options through when supported', function test( t ) {
104104
tape( 'the function returns an error if options are provided and options are unsupported', function test( t ) {
105105
var stat = proxyquire( './../lib/sync.js', {
106106
'fs': {
107-
// If a function only accepts (path), its `.length` will be 1:
108-
'statSync': function stat1( path ) { // eslint-disable-line no-unused-vars
109-
return {};
107+
'statSync': function stub() {
108+
throw new TypeError( 'unsupported option' );
110109
}
111110
}
112111
});
113112

114113
var out = stat( __filename, {
115114
'bigint': false
116115
});
117-
t.strictEqual( out instanceof Error, true, 'returns an error' );
118-
t.strictEqual( out.name, 'TypeError', 'returns a type error' );
116+
t.strictEqual( out instanceof TypeError, true, 'returns a TypeError' );
119117
t.end();
120118
});
121119

0 commit comments

Comments
 (0)