@@ -84,3 +84,40 @@ fn vcs_dirs_ignored() {
8484 . with_cwd ( PathBuf :: from ( "tests/fixtures/vcs_dirs" ) )
8585 . test_and_snapshot_multiple ( & [ & [ "--check" ] ] ) ;
8686}
87+
88+ #[ test]
89+ fn exclude_nested_paths ( ) {
90+ // Test that nested path exclusion works correctly
91+ // See: https://github.com/oxc-project/oxc/issues/14684
92+ // All these cases should not report parse error from `foo/bar/error.js`
93+ Tester :: new ( )
94+ . with_cwd ( PathBuf :: from ( "tests/fixtures/exclude_nested" ) )
95+ . test_and_snapshot_multiple ( & [
96+ & [ "--check" , "!foo/bar/error.js" ] ,
97+ & [ "--check" , "!foo/bar" ] ,
98+ & [ "--check" , "!foo" ] ,
99+ & [ "--check" , "!**/error.js" ] ,
100+ & [ "--check" , "foo" , "!foo/bar/error.js" ] ,
101+ & [ "--check" , "foo" , "!foo/bar" ] ,
102+ & [ "--check" , "foo" , "!**/bar/error.js" ] ,
103+ & [ "--check" , "foo" , "!**/bar/*" ] ,
104+ ] ) ;
105+ }
106+ #[ test]
107+ fn exclude_nested_paths_with_dot ( ) {
108+ // All these cases should not report parse error from `foo/bar/error.js`
109+ // TODO: Make the commented cases work as well.
110+ Tester :: new ( )
111+ . with_cwd ( PathBuf :: from ( "tests/fixtures/exclude_nested" ) )
112+ . test_and_snapshot_multiple ( & [
113+ // &["--check", ".", "!foo/bar/error.js"],
114+ // &["--check", ".", "!foo/bar"],
115+ & [ "--check" , "." , "!foo" ] ,
116+ & [ "--check" , "." , "!**/error.js" ] ,
117+ & [ "--check" , "./foo" , "!**/bar/error.js" ] ,
118+ & [ "--check" , "./foo" , "!**/error.js" ] ,
119+ & [ "--check" , "./foo" , "!**/bar/*" ] ,
120+ // &["--check", "./foo", "!foo/bar/error.js"],
121+ // &["--check", "./foo", "!foo/bar"],
122+ ] ) ;
123+ }
0 commit comments