@@ -10,7 +10,7 @@ Jsonnetunit is a unit test framework for [Jsonnet](http://jsonnet.org/).
1010
1111` example_test.jsonnet ` :
1212``` jsonnet 
13- local test = import "path/to/ jsonnetunit/test.jsonnet "; 
13+ local test = import "jsonnetunit/test.libsonnet "; 
1414
1515test.suite({ 
1616    testIdentity: {actual: 1, expect: 1}, 
@@ -24,14 +24,26 @@ test.suite({
2424}) 
2525``` 
2626
27+ Then, just evaluate your test file with ` jsonnet ` .
2728``` console 
28- $ jsonnet example_test.jsonnet  
29+ $ jsonnet -J path/to/jsonnetunit  example_test.libsonnet  
2930{ 
3031    "verify": "Passed 3 test cases" 
3132} 
3233``` 
3334
34- See ` std_matchers_test.jsonnet `  for more examples of other matchers.
35+ On failure, it emits an error report and exits with non-zero status.
36+ ``` console 
37+ $ jsonnet -J path/to/jsonnetunit example_test.jsonnet 
38+ RUNTIME ERROR: Failed 11/11 test cases: 
39+ testFoo: Expected 1 to be 2 
40+ testBar: Expected 1 to satisfy the function 
41+ testBaz: Expected 1 to satisfy the condition that the value is between 1 and 2 
42+       ./jsonnetunit/test.libsonnet:40:13-25   object <anonymous> 
43+       During manifestation 
44+ ``` 
45+ 
46+ See ` jsonnet/test/std_matchers_test.jsonnet `  for more examples of other matchers.
3547
3648## How to install  
3749
@@ -50,7 +62,7 @@ $ git clone https://github.com/yugui/jsonnetunit.git
5062    Test files must be ` .jsonnet `  files which manifestize a result of ` test.suite `  function.
5163
5264    ``` jsonnet 
53-     local test = import "path/to/jsonnetunit/test.jsonnet "; 
65+     local test = import "path/to/jsonnetunit/test.libsonnet "; 
5466    test.suite({ 
5567    }) 
5668    ``` 
@@ -130,7 +142,7 @@ You can also define your own expectation matcher.
130142
131143    e.g.
132144    ``` jsonnet 
133-     local setMatcher(actual, expected) = import "path/to/ matcher.jsonnet " { 
145+     local setMatcher(actual, expected) = import "jsonnetunit/ matcher.libsonnet " { 
134146        satisfied: std.set(actual) == std.set(expected), 
135147        positiveMessage: "Expected " + actual + " to be equal to " + expected + " as a set", 
136148        negativeMessage: "Expected " + actual + " not to be equal to " + expected + " as a set", 
@@ -164,6 +176,30 @@ You can also define your own expectation matcher.
164176        }, 
165177    } 
166178    ``` 
179+      
180+ ### Running with [Bazel](https://bazel.build/) 
181+ Use `jsonnet_test` rule. 
182+ * `WORKSPACE`: 
183+    
184+   ```bzl 
185+   ... 
186+   git_repository( 
187+       name = "com_github_yugui_jsonnetunit", 
188+       remote = "https://github.com/yugui/jsonnetunit.git", 
189+       tag = "0.0.2", 
190+   ) 
191+    ``` 
192+   
193+ *  ` BUILD ` :
194+   
195+   ``` bzl 
196+   load(" @com_github_yugui_jsonnetunit//jsonnetunit:jsonnetunit.bzl"  , " jsonnet_test"  )
197+   
198+   jsonnet_test(
199+       name  =  " your_test"  ,
200+       src  =  " your_test.jsonnet"  ,
201+   )   
202+   ``` 
167203
168204# Copyright  
169205
0 commit comments